I am trying to run a script which ultimately runs a pagekite python file. The Pagekite offers tunnelling service for localhost to be publicly accessible. My aim is to run the pagekite.py when the Pi is booted and the website is up and running. I am trying to run the script with root permissions. I tried using two approaches:
- Using the
# crontab -e
with root privileges and adding@reboot bash -x /home/username/myscript.sh
in crontab file - Adding the script file in
/etc/init.d
and creating symlink withsudo ln -s /etc/init.d/myscript.sh /etc/rc.d/
.
However none of these approaches tend to work. Please note, I have kept the python file in the same location as of the script (Earlier, I even tried adding the cd
command to the destination folder containing pagekite.py
in myscript.sh
script.). Also sudo is needed in the prefix for running the python script. After attempting the reboot, nothing happens and the web page is unreachable.Apart from that, is it possible to run the script automatically and display the kite status in the terminal, like the one we get if we manually run the pagekite script ? Check the image below for what I mean by "kite status in terminal window"
Contents of myscript.sh
file
#!/bin/sh
sudo python3 pagekite.py 80 furball.pagekite.me
Contents of sudo crontab -e
@reboot sudo bash -x /home/username/Desktop/myscript.sh
The py file and sh are both present in same directory.