Hello, I would like to run this script every 5 minutes. It checks needed procesess and start them if they are not running. I need to run mopidy and deluge-web in new lxterminal window. When I try to run this script from terminal, it works without problem. Howewer when this script is scheduled from crontab it only starts deluged(beceuse it is daemon) and nothing more. Script:
Code: Select all
#!/bin/bash
mopidy_state=`ps -e | grep "mopidy"`
if [ "$mopidy_state" == "" ];
then
sudo lxterminal -e mopidy
else echo "mopidy is running correctly"
fi
deluged_state=`ps -e | grep "deluged"`
if [ "$deluged_state" == "" ];
then
deluged
else echo "deluged is running correctly"
fi
delugeweb_state=`ps -e | grep "deluge-web"`
if [ "$delugeweb_state" == "" ];
then
sudo lxterminal -e deluge-web
else echo "deluge-web is running correctly"
fi
Alternatively it could be started from some kind of start script after boot. But I would like to have it like this, because it handle also situations when process abnormaly falls/abends without restart of Pi.
Thank you.