Create a script anywhere you want it to be, preferably in your home directory. I like to call mine,
check_docky.bsh. In your script, do the following lines:
ps -ef | grep -i docky.exe | grep -v grep >/dev/null
case $? in
1) sh -c "mono /usr/lib/docky/Docky.exe";;
0) exit 0;;
In the above script, the
ps -ef | grep will look to see if
Docky is running. If it is not running the exit code that gets returned is
1, so then the case statement would relaunch
Docky automatically. Else, the script would exit normally with a code
Make sure the script is executable:
chmod +x check_docky.bsh
Then create a
cron job for the script.
crontab as you:
$ crontab -e
Then as a new entry add the following so that it will check every 10 minutes starting at
:00 of the hour:
# m h dom mon dow command
*/10 * * * * /home/<username>/check_docky.bsh
To show that this command works:
~$ ps -ef | grep wookie | grep -v grep
~$ echo $?
~$ ps -ef | grep wookie
terrance 20978 6976 0 13:53 pts/17 00:00:00 grep --color=auto wookie
~$ echo $?
Hope this helps!