计划任务的作用:计划任务主要是做一些周期性的任务,目前最主要的用途是定期备份数据。
计划任务分两类:一次性调度执行 : at——Schedule one-time tasks with at.
循环调度执行: cron——Schedule recurring jobs with cron.
一、一次性调度执行at的用法
at <TIMESPEC>
ctrl + D :结束编辑并运行命令
<TIMESPEC>的内容可以是以下几个命令
now +5min 5分钟后
teatime tomorrow (teatime is 14:00) 下午茶时间
noon +3 days 第3天中午
3pm august 3 2030 2030年8月3日下午5点
4:00 2019-11-27 某年某月某日某时
例:

二、循环调度执行的使用方法
计划任务存储位置 [root@localhost ~]# ls /var/spool/cron/
1. 创建计划 :crontab -e Edit jobs for the current user


五个*号分别是 分时日月周,ls /tmp 是命令也可跟脚本程序
查询计划 :crontab -l List the jobs for the current user

删除计划 :crontab -r Remove all jobs for the current users.
