To setup commands which will repeatedly run at a set time, you
can use the crontab command. To edit your crontab file, issue the
following command:
crontab -e
This will allow you to edit your existing crontab, or if you don’t have
one, it will create it (as root, you can also edit other users crontab
by issuing ‘crontab -u username -e’).
The syntax of this file is as such.
minute hour day-of-the-month month day-of-the-week command
If I wished to have a script named filecleanup.sh run every day at 4am, my crontab would look like this:
0 4 * * * /usr/local/bin/filecleanup.sh
If I wished to have this file run at 4am only on Sundays, the crontab would look like this:
0 4 * * 0 /usr/local/bin/filecleanup.sh
