Crontab script

Crontab is a software for *nix systems that enables users to run a certain application at specified times.

A problem, at least for me, arises when I want to run an application only if it isn’t already running. For that, I wrote this simple bash script. It’s not perfect but I didn’t find anything serving this purpose on the web. If you do, please send it to me :)

Just replace myusername with your login, appname with the command name of your application. It may not work if your ps aux listing does not show a ./ before the appname.

And of course, put it in your crontab (just crontab -e). My crontab looks like this:

01 22,23,00,01,02,03,04,05,06,07,08 * * * ~/start.cron

(which means start.cron will be run every hour from 22 to 8 )

Download start.cron


Posted

in

by

Tags: