- Create a file called crons.cron in your home directory (or anywhere you want).
- Add your cron jobs to it.
- Run crontab crons.cron to create the jobs.
- Run crontab -l to check that they've been created properly.
Example crons.cron
This sets up a cron job that lists the contents of a user's home directory, every 15 minutes.
*/15 * * * * ls /home/user
Sending email
Vixiecron will attempt to send email to the user with the result of the cron jobs. This of course means you need email configured correctly on the machine.
To specify which email address receives the email, add the MAILTO variable to the list of jobs, as follows.
MAILTO=user@domain.com */15 * * * * ls /home/steph
Example
Here's a full example, using the crons.cron file mentioned above.
username@localhost # cat crons.cron MAILTO=user@domain.com */15 * * * * ls /home/steph username@localhost # crontab crons.cron username@localhost # crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (crons.cron installed on Fri Feb 23 13:12:28 2007) # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $) MAILTO=user@domain.com */15 * * * * ls /home/username
