Linux Configuration timed task, we all know the use of crontab this system function, but sometimes we need to distinguish user execution, the following directly say the difference between 2 methods:
Method 1:
Use the command crontab-e and then edit the timed script directly.
After this implementation, the user-defined, will be written to the/var/spool/cron directory, to generate a consistent user name file, the file content is our edited timed script.
Such as:
[Root@localhost cron.d]# Cd/var/spool/cron
[root@localhost cron]# ll
total dosage 4
-rw-------. 1 root root 52 December 9 1 0:58 root
[root@localhost cron]# pwd
/var/spool/cron
[root@localhost cron]# cat Root
* * */root/au tomysqlbackup.sh
Method 2:
Use the command Vi/etc/crontab to edit the timed script.
Such as:
[Root@localhost ~]# Cat/etc/crontab S Hell=/bin/bash path=/sbin:/b
In:/usr/sbin:/usr/bin Mailto=root
home=/
# Run-parts
* * * * * root/usr/sbin/ntpdate 210.72.145.44 #30 8 * * * root/usr/sbin/ntpdate 132.228.90.101
* * * * Root run-parts/etc/cron.hourly
4 * * * Root run-parts/etc/cron.daily
4 * * 0 root run-parts/etc/cron.weekly
4 1 * * Root run-parts/etc/cron.monthly
*/1 * * * * Root run-parts/opt/openoffice.org3/program/start.sh
############################################ 4 * * * * ROOT/USR/BIN/RSYNC-VZRTOPG--progress--delete root@192.168.231. 35::resource/hyy/bak/resource 4 * * * ROOT/USR/BIN/RSYNC-VZRTOPG--progress--delete root@192.168.231.35::log/hyy/ Bak/log ############################################ [Root@localhost ~]#
(System level) do system-level configuration we will directly configure/etc/crontab
(User-level) is generally recommended to use CRONTAB-E, so the system will also help check our configured script syntax.
This article discusses the Linux configuration timing, the use of crontab-e and direct editing/etc/crontab is the difference between the small series to share all the content, I hope to give you a reference, but also hope that we support the cloud habitat community.