Linux下如何在特定时间执行特定任务1 仅执行一次的任务
2 循环执行的任务
3 可唤醒停机期间的工作任务1 仅执行一次的任务
所需程序
atd服务
at命令
启动atd # service atd restart
atd stop/waiting
atd start/running, process 11031
千万注意要在root下执行,不然会提示Rejected send message.at的使用
使用at的权限(因为安全性考虑最好设置)
在/etc/at.allow中设置可以使用at的账号
在/etc/at.deny中设置不可以使用at的账号
示例
1分钟后执行mkdir $ at now + 1 minutes
warning: commands will be executed using /bin/sh
at> mkdir helloAt
at> <EOT>
job 1 at Wed Feb 6 14:36:00 2013
查看工作 # at -c 2
#!/bin/sh
# atrun uid=0 gid=0
# ...
$ mkdir helloAt
特定时间关机 $ at 14:00 2013-2-9
warning: commands will be executed using /bin/sh
at> /bin/sync
at> /bin/sync
at> /sbin/shutdown -h now
at> <EOT>
job 4 at Sat Feb 9 14:00:00 2013
at如何执行
输入输出:标准输入输出会重定向到mailbox里,所以执行echo "hello"在终端下是看不到的
后台工作:系统会将at工作独立于shell,交给atd程序接管,即使关了shell也没关系
查询与删除at中的工作
查询:atq
删除:atrm jobid
batch:和at相似,只是在cpu负载低时才执行
Arch Linux上安装QEMU+EFI BIOS通过XShell链接虚拟机的CentOS相关资讯 Linux计划任务 Linux定时任务
- Linux 计划任务 Cron (今 10:31)
- Linux crond定时任务 (01月25日)
- Linux定时任务中用脚本代替可执行 (06/06/2015 06:37:39)
| - Linux Crontab 定时任务 命令详解 (02月13日)
- Linux定时任务(crontab)实例 (08/01/2015 09:59:30)
- Linux定时任务访问页面代替Quartz (09/11/2014 20:13:22)
|
本文评论 查看全部评论 (0)