The crontab command
The crontab files are not generated by editing a the crontab file in the crontab spool directory, instead the command crontab is used to edit, list, create or remove a crontab file for a user. The crontab command can be used by all the users on a system to create personal crontab as well as by the root account. Users are not allowed to view, edit or create crontab files for other users.
Additionally, the use of cron can be denied to users. This is done to prevent system unfriendly, or security compromising tasks to be performed. When the crontab command is invoked it examines the files cron.deny and cron.allow in the system's cron directory to grant or revoke the modification of the crontab spool file. If a username appears in the file cron.allow, the crontab command may be executed. If that file does not exist and the users name does not appear in the cron.deny file then cron can be used. If only an empty cron.deny exists, all users can use cron. If neither of these files exist, then only the root user can use cron.
The crontab command without options reads from standard input, so when executed it takes the information entered at the keyboard as input. This makes it easy to remove the existing crontab without really trying. If the crontab is run without options it should be exited with a "Control C" so that the existing crontab is unmodified. Entering a "Control D" will cause the current users' crontab to be replaced with no information, thereby erasing the existing crontab.
The edit option crontab -e for the crontab command copies or creates the current user's crontab file. After editing is complete, the file is installed as the user's crontab file in the crontab spool directory. The default editor used by this command is ed. To specify an alternative, set the environment variable EDITOR. Not all systems' crontab have an edit option. In this case, a file containing the crontab information can be created and read from by the crontab command.
The list option, crontab -l, displays the contents of the current user's crontab file.
The remove option, crontab -r, empties the contents of the current user's crontab file.
The crontab command will accept an account name as the first argument if current user has superuser privileges.
Here is a sample session that adds a crontab entry for the current user, lists the crontab entry and then removes it.
#crontab -e (Create the crontab entry)(within an editor enter) 1 * * * * /usr/local/bin/runreport# crontab -l (List the users' crontab file) 1 * * * * /usr/local/bin/runreport # crontab -r (Remove the users' crontab file)
Using the crontab command without options to create the crontab file can be done by creating and editing a file. In this example, allcron.
#vi allcron #crontab allcron
jerry.lee | 제리
http://blog.naver.com/jeeunglee/140014971896
댓글 없음:
댓글 쓰기