Setting up a cron job in /etc/cron.hourly,cron.daily,etc…

If you have a script that you want to setup at varying time intervals, including but not limited to certain days of the week or specific hours in a day then those commands should go in /etc/crontab.

However, if you want to simply run your script on an hourly or daily basis you can simply put a sym link in /etc/cron.daily or hourly.

Best way to do this is put your actual script in /usr/bin and create a sym link in the appropriate cron directory.

/etc/cron.daily$ sudo ln -s /usr/bin/ ./memcache_save_data

Bingo! No more to do. /etc/crontab runs all files in this folders automatically

Note: Cron does not allow you to have file extensions on files in /etc/cron dirs. Also, if you need to pass parameters to the script then you need to run this in /etc/crontab as there is no way to specify these with the above option.

Leave a Reply