crontab -a filename | Install filename as your crontab file. On many systems, this command is executed simply as crontab filename (i.e., without the -a option). |
crontab -e | Edit your crontab file, or create one if it doesn't already exist. |
crontab -l | Display your crontab file. |
crontab -r | Remove your crontab file. |
crontab -v | Display the last time you edited your crontab file. (This option is available on only a few systems.) |
crontab -u user | Used in conjunction with other options, this option allows you to modify or view the crontab file of user . When available, only administrators can use this option. |
Field | Value | Description |
minute | 0-59 | The exact minute that the command sequence executes |
hour | 0-23 | The hour of the day that the command sequence executes |
day | 1-31 | The day of the month that the command sequence executes |
month | 1-12 | The month of the year that the command sequence executes |
weekday | 0-6 | The day of the week that the command sequence executes (Sunday = 0, Monday = 1, Tuesday = 2, and so forth) |
command | Special | The complete sequence of commands to execute. The command string must conform to Bourne shell syntax. Commands, executables (such as scripts), or combinations are acceptable. |
# Example 1: 0,30 8-17 * * 1-5 cmd
Show/Hide Answer (+/-)
Run cmd on the half-hour from 8:00 AM to 5:30 PM, Monday thru Friday
# Example 2: 0 12 1,15 * 5 cmd
Show/Hide Answer (+/-)
Run cmd at noon each Friday AND the first and fifteenth of every month
# Example 3: 17 3 * * 1 cmd
Show/Hide Answer (+/-)
Run cmd at 3:17 AM Monday (a backup program perhaps)
# Example 4:
# This command sends a "popup" message to the user's screen,
# at 3:00 PM Fridays, if they are logged in:
0 15 * * 5 echo "Time for staff meeting" | write $LOGNAME >/dev/null 2">"&1
# Example 5:
# This command sends a multi-line "popup" message to the user's screen,
# at 3:00 PM Fridays, if they are logged in:
0 15 * * 5 write $LOGNAME '>'/dev/null 2'>'&1 %Time for the%staff meeting.
No comments:
Post a Comment