Crontab aix

Solo disponible en BuenasTareas
  • Páginas : 6 (1407 palabras )
  • Descarga(s) : 0
  • Publicado : 10 de marzo de 2011
Leer documento completo
Vista previa del texto

crontab Command


Submits, edits, lists, or removes cron jobs.


crontab [ -e [UserName] | -l [UserName] | -r [UserName] | -v [UserName] | File ]


The crontab command submits, edits, lists, or removes cron jobs. A cron job is a command run by thecron daemon at regularly scheduled intervals. To submit a cron job, specify the crontab command with the -e flag. The crontab command invokes an editing session that allows you to create a crontab file. You create entries for each cron job in this file. Each entry must be in a form acceptable to the cron daemon. For information on creating entries, see The crontab File Entry Format.
When youfinish creating entries and exit the file, the crontab command copies it into the /var/spool/cron/crontabs directory and places it in a file named for your current user name. If a file with your name already exists in the crontabs directory, the crontab command overwrites it.
Alternatively, you can create a crontab file by specifying the File parameter. If the file exists, it must be in the format thecron daemon expects. If the file does not exist, the crontab command invokes the editor. If the EDITOR environment variable exists, the command invokes the editor it specifies. Otherwise, the crontab command uses the vi editor.
To list the contents of your crontab file, specify the crontab command with the -l flag. To remove an existing file, use the -r flag.
The optional UserName parameter canbe used by the owner of the crontab file or by the root user to edit, list, remove, or verify the status of the cron jobs for the specified user. If the UserName is invalid, an error message is generated and the program exits.
If the optional UserName parameter is not specified, the crontab flags are available for the root user and the current user.


Only the root user or the ownerof the crontab file can use UserName following the -e, -l, -r, and -v flags to edit, list, remove, or verify the crontab file of the specified user.

The cron Daemon

The cron daemon runs commands according to the crontab file entries. Unless you redirect the output of a cron job to standard output or error, the cron daemon mails you any command output or errors. If you specify a cron jobincorrectly in your crontab file, the cron daemon does not run the job.
The cron daemon examines crontab files only when the cron daemon is initialized. When you make changes to your crontab file using the crontab command, a message indicating the change is sent to the cron daemon. This eliminates the overhead of checking for new or changed files at regularly scheduled intervals.

Controls onUsing the crontab Command

The /var/adm/cron/cron.allow and /var/adm/cron/cron.deny files control which users can use the crontab command. A root user can create, edit, or delete these files. Entries in these files are user login names with one name to a line. If your login ID is associated with more than one login name, the crontab command uses the first login name that is in the /etc/passwd file,regardless of which login name you might actually be using. Also, to allow users to start cron jobs, the daemon attribute in the /etc/security/user file should be set to TRUE , using the chuser command.
The following is an example of an cron.allow file:
If the cron.allow file exists, only users whose login names appear in it can use the crontab command. The root user'slog name must appear in the cron.allow file if the file exists. A system administrator can explicitly stop a user from using the crontab command by listing the user's login name in the cron.deny file. If only the cron.deny file exists, any user whose name does not appear in the file can use the crontab command.
A user cannot use the crontab command if one of the following is true:
• The...
tracking img