linux / unix crontab command
by Nirmala[ Edit ] 2009-11-07 15:43:28
crontab command is used to schedule periodic background work.
The crontab utility shall create, replace, or edit a user's crontab entry; a crontab entry is a list of commands and the times at which they shall be executed. The new crontab entry can be input by specifying file or input from standard input if no file operand is specified, or by using an editor, if -e is specified.
syntax:
crontab [-e] [-l] [-r] [filename]
-e -> edit a copy of the current user's crontab file, or creates an empty file to edit if crontab does not exist. When editing is complete, the file is installed as the user's crontab file. If a user- name is given, the specified user's crontab file is edited, rather than the current user's crontab file; this may only be done by a super-user. The environment variable EDITOR determines which editor is invoked with the -e option. The default editor is ed. Note that all crontab jobs should be submitted using crontab ; you should not add jobs by just editing the crontab file because cron will not be aware of changes made this way.
-l -> list the crontab file for the invoking user. Only a super-user can specify a username following the -r or -l options to remove or list the crontab file of the specified user.
-r -> remove a user's crontab from the crontab.
filename -> The filename that contains the commands to run.