计划任务 at #只能执行一次 语法 at 时间 服务atd 必须开启 [root@ZQ ~]# systemctl status atd.service #查看atd服务状态 ● atd.service - Job spooling tools Loaded: loaded (/usr/lib/systemd/system/atd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2017-06-05 13:00:27 CST; 7min ago Main PID: 1166 (atd) CGroup: /system.slice/atd.service └─1166 /usr/sbin/atd -f Jun 05 13:00:27 ZQ systemd[1]: Started Job spooling tools. Jun 05 13:00:27 ZQ systemd[1]: Starting Job spooling tools... [root@ZQ ~]# date Mon Jun 5 13:08:34 CST 2017 [root@ZQ ~]# at 13:11 at> echo `data` > /tmp/date.ext at> <EOT> job 1 at Mon Jun 5 13:11:00 2017 [root@ZQ ~]# date Mon Jun 5 13:10:36 CST 2017 [root@ZQ ~]# ls /tmp/ CVU_12.1.0.2.0_oracle systemd-private-7b32fa1bbfa14092932ffe412d0d528d-rtkit-daemon.service-ivM7Ax date.ext systemd-private-7b32fa1bbfa14092932ffe412d0d528d-vmtoolsd.service-HhtqSh hogsuspend systemd-private-f05972506cf74169b213ca382fbf0af5-colord.service-coCDy6 linuxamd64_12102_database_2of2.zip systemd-private-f05972506cf74169b213ca382fbf0af5-cups.service-MIl1vE ssh-uaeT8B8iT7oQ systemd-private-f05972506cf74169b213ca382fbf0af5-rtkit-daemon.service-3DbcmZ systemd-private-7b32fa1bbfa14092932ffe412d0d528d-colord.service-zVDfng systemd-private-f05972506cf74169b213ca382fbf0af5-vmtoolsd.service-agCWo2 systemd-private-7b32fa1bbfa14092932ffe412d0d528d-cups.service-CkpC5p tracker-extract-files.1000 [root@ZQ ~]# at 1:30 2017-6-5 at: refusing to create job destined in the past [root@ZQ ~]# at 13:30 2017-6-5 at> echo aaa > /tmp/a.txt at> <EOT> job 2 at Mon Jun 5 13:30:00 2017 [root@ZQ ~]# at now+10min at> echo bbb > /tmp/b.txt at> <EOT> job 3 at Mon Jun 5 13:30:00 2017 [root@ZQ ~]# at -l #查询计划任务 2 Mon Jun 5 13:30:00 2017 a root 3 Mon Jun 5 13:30:00 2017 a root [root@ZQ ~]# ll /var/spool/at/* -rwx------ 1 root root 2951 Jun 5 13:19 /var/spool/at/a00002017c9d8a -rwx------ 1 root root 2951 Jun 5 13:20 /var/spool/at/a00003017c9d8a /var/spool/at/spool: total 0 计划任务创建成功后都会在一下目录创建脚本文件 [root@ZQ ~]# vim /var/spool/at/a00002017c9d8a at删除 [root@ZQ ~]# at -l 2 Mon Jun 5 13:30:00 2017 a root 3 Mon Jun 5 13:30:00 2017 a root [root@ZQ ~]# atrm 3 [root@ZQ ~]# at -l 2 Mon Jun 5 13:30:00 2017 a root [root@ZQ ~]# ll /var/spool/at/* -rwx------ 1 root root 2951 Jun 5 13:19 /var/spool/at/a00002017c9d8a /var/spool/at/spool: total 0