Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need the exact code that I would use because I'm not able to figure it out. I use crontab -e to set up a cron job but when I save it, it never works. I'm also just trying to run a file called newmail.sh from the root user.

share|improve this question

1 Answer 1

If you wanted the task to run every day at 3:17pm, you would use:

17 15 * * * root newmail.sh

This says "run newmail.sh as root every day of the week, every day of the month, every month at 3:17pm."

minute hour dom month dow user cmd

minute - This controls what minute of the hour the command will run on, and is between '0' and '59'

hour - This controls what hour the command will run on, and is specified in the 24 hour clock, values must be between 0 and 23 (0 is midnight)

dom - This is the Day of Month, that you want the command run on, e.g. to run a command on the 19th of each month, the dom would be 19.

month This is the month a specified command will run on, it may be specified numerically (0-12), or as the name of the month (e.g. May)

dow - This is the Day of Week that you want a command to be run on, it can also be numeric (0-7) or as the name of the day (e.g. sun).

user - This is the user who runs the command.

cmd - This is the command that you want run. This field may contain multiple words or spaces.

from: http://www.unixgeeks.org/security/newbie/unix/cron-1.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.