Linux configuration timed tasks, we all know the use of crontab this system function, but sometimes we need to distinguish between user execution, the following directly say the difference between the 2 ways:
Method 1:
Use the command crontab-e and edit the timed script directly.
After this execution, the user-defined, will be written to the/var/spool/cron directory, generate a file with the user name consistent with the file content is our editor's timed script.
Such as:
[[email protected] cron.d]# Cd/var/spool/cron[[email protected] cron]# ll total dosage 4-rw-------. 1 root root 52 December 9 10:58 root[[email protected] cron]# Pwd/var/spool/cron[[email protected] cron]# Cat Root 30 03 * * */root/automysqlbackup.sh
Method 2:
Edit the timed script using the command vi/etc/crontab.
Such as:
[[email protected] ~]# Cat/etc/crontab Shell=/bin/bash Path=/sbin:/bin:/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/e Tc/cron.hourly 4 * * * Root run-parts/etc/cron.daily 4 * * 0 Roo T run-parts/etc/cron.weekly 4 1 * * Root run-parts/etc/cron.monthly */1 * * * * Root run-parts/opt/openoffice.org3/program/start.sh ################## ########################## 30 4 * * * ROOT/USR/BIN/RSYNC-VZRTOPG--progress--delete [Email protected]::resource/hyy/bak/resource 4 * * * * root /USR/BIN/RSYNC-VZRTOPG--progress--delete [email protected]::log/hyy/bak/log############################### #############[[email protected] ~]#
System-level configuration we will directly configure the/etc/crontab
(User-level) is generally recommended to use CRONTAB-E, so the system will also help to check our configured script syntax.
Linux configuration timing, the difference between using CRONTAB-E and direct edit/etc/crontab