阅读目录
1、什么是例行性命令
1.1:linux工作排程的种类
1.2:系统常见的例行性命令有哪些
1. 什么是例行性命令
1.1 linux工作排程的种类:
linux例行性命令主要有两种:
- at:仅执行一次就从linux的任务中取消
- cron:将持续例行性的工作下去
1.2 系统常见的例行性命令有哪些:
2. 仅执行一次的工作排程
建立date.sh
#!/bin/bash
#program: this program to show time like: yyy-mm-dd hh-mm-ss AM/PM
#history:
#2009-10-07 first realease lin xiyu
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
echo "Today is 'date +%F\ %r'"
给test1用户发送邮件
at 16:57
at>/bin/mail -s "'/bin/bash /root/date.sh'" test1
at>
job 48 at 2009-10-07 16.57
ls -ls /var/spool/at #显示该目录下的at例行性命令
mail #在test1用户中查询邮件
t 1 #全部显示第一封邮件
x #退出
ls /etc/ | grep at #显示/etc目录下所有含有at字符的文件
第二种
vi t1.txt
at 17:05 2009-10-07
at>/bin/mail -s "'/bin/bash /root/date.sh'" test1<t1.txt
at> <EOT>
job 48 at 2009-10-07 17:05
第三种和-m的解释
at -m 05:07pm october 7
at>/bin/mail -s "'/bin/bash /root/date.sh'" test1<t1.txt
at> <EOT>
job 48 at 2009-10-07 17:05
第四种:
at -m now + 1 minute
at>/bin/mail -s "'/bin/bash /root/date.sh'" test1<t1.txt
at> <EOT>
job 48 at 2009-10-07 17:05