计划任务
发表于|更新于
|字数总计:272|阅读时长:1分钟|阅读量:
计划任务服务crond
作用:解放我们的双手,解放我们的时间
- 计划任务,让系统在将来的指定时间点执行某些任务(程序)
 
- 计划任务,可以周期性执行也可以仅仅执行一次
 
- Linux系统中的计划任务
at和crong服务是操作系统内置的2个服务,默认情况是安装好的。 
编写配置文件方法:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
   | [root@localhost etc]# 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
 
  前5个字段分别表示: 分钟:0-59 小时:0-23 日期:1-31 月份:1-12 星期:0-7(0表示周日或者7表示周日)
   | 
 
使用命令编辑自己的定时任务:
1 2 3 4
   | crontab -e 设置计时器 -l 列出当前计时器的设置 -r 删除计时器的设置(不建议使用)
   | 
 
日志切割参考
https://pengyirui.gitee.io/posts/f708.html