How to create vixie-cron jobs

  1. Create a file called crons.cron in your home directory (or anywhere you want).
  2. Add your cron jobs to it.
  3. Run crontab crons.cron to create the jobs.
  4. 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

References

Last modified: 09/03/2007 Tags: ,

Go to top

Related Pages

Other pages possibly of interest:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top