周期性计划任务crontab
通过使用crond工具,来让系统周期性的执行一些脚本命令,来到达系统“自动化”的需求。
管理计划任务命令:编辑、查看、删除
cat /etc/crontab,查看crontab的格式要求以及配置信息
[root@ljp /]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
crontab -e [-u 用户名] 编辑计划任务
*/1 * * * * /usr/bin/echo "123" >> test.txt
#每分钟 向test.txt输入123
[root@ljp /]# cat test.txt
123
[root@ljp /]# cat test.txt
123
123
crontab -l [-u 用户名] 查看计划任务