The use of Linux crontab
Preparation (Lab building needs, actual environment not required):
sudo service rsyslog start
sudo cron-f &
Crontab use
Add Task: CRONTAB-E
Add a line: */1 * * * * touch/home/shiyanlou/$ (date +\%y\%m\%d\%h\%m\%s)
View tasks: Crontab-l
Monitoring execution: PS aux | grep cron
Monitoring Log feedback information: sudo tail-f/var/log/syslog
Delete Task: Crontab-r
Additional:
The role of each directory:
/etc/cron.daily, the script in the directory executes once a day and runs at 6:25 each day;
/etc/cron.hourly, the script in the directory executes once per hour and runs at 17 minutes per hour;
/etc/cron.mouthly, the script in the directory will be executed once a month and run at 6:52 on the monthly 1th;
/etc/cron.weekly, the script in the directory executes once a week and runs 6:47 on the seventh day of the week;
The use of Linux crontab