Reputation: 471
I am writing a script to check and restart wifi on a raspberry pi. It should also kill and relaunch chromium. I have set a job to run every minute from crontab, that command is:
*/1 * * * * /usr/local/bin/checkwifi.sh
Inside of checkwifi.sh:
ping -c4 192.168.1.1 > /dev/null
if [ $? != 0]
then
sudo /sbin/ifdown 'wlan0'
sleep 5
sudo /sbin/ifup --force 'wlan0'
sudo pkill chromium
sleep 10
/usr/bin/chromium --kiosk "http://some-website-here"
fi
Everything up to launching chromium works, including killing any running instance of chromium. The last line errors out silently, or at least I haven't found any error logging.
Additionally, if I run...
/usr/local/bin/checkwifi.sh
...from terminal, it works fine.
Any ideas?
Upvotes: 0
Views: 2860
Reputation: 26
Just from top of my head, maybe problem is the display environment value?
Try 'export DISPLAY=:0.1' or whatever display number your Xorg has.
Upvotes: 1