计划任务 at , crontab
2016-09-27 00:00
232 查看
一、at
at now +1 minutes // 一份钟后启动
at> date >/opt/ok
at> ctrl +d
at 04pm +3 days //三天后的下午四点钟启动
at>date > /opt/ok
at>ctrl + d
执行结果
atd
at -l //列出at任务列表
atrm | at -d ID号 删除at任务列表
二 、crontab
# 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
每分钟:*/1 * * * * /bin/ls
每小时:* */1 * * * /bin/ls
每天的1点:* 1 * * * /bin/ls
每天的10,12,13-15 * 10,12,13-15 * * * /bin/ls
每周日00点 * 0 * * 0|7|sun /bin/ls
在/etc/crontab里面进行设置也是生效的只是需要加上用户名
crontab -e为当前登录用户添加计划任务
su root
crontab -e
*/1 * * * * echo " hello word" >> /opt/ok //每隔一秒将hello word 写入/opt/ok里
su user1
crontab -e
*/1 * * * * echo "hello friday" >> /opt/ok //每隔一秒将hello friday 写入/opt/ok 里面
crontab -l列出当前登录用户的计划任务
crontab相关目录
/etc/cron.d /etc/cron.monthly
/etc/cron.daily /etc/crontab
/etc/cron.deny /etc/cron.weekly
/etc/cron.hourly
at now +1 minutes // 一份钟后启动
at> date >/opt/ok
at> ctrl +d
at 04pm +3 days //三天后的下午四点钟启动
at>date > /opt/ok
at>ctrl + d
执行结果
atd
at -l //列出at任务列表
atrm | at -d ID号 删除at任务列表
二 、crontab
# 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
每分钟:*/1 * * * * /bin/ls
每小时:* */1 * * * /bin/ls
每天的1点:* 1 * * * /bin/ls
每天的10,12,13-15 * 10,12,13-15 * * * /bin/ls
每周日00点 * 0 * * 0|7|sun /bin/ls
在/etc/crontab里面进行设置也是生效的只是需要加上用户名
crontab -e为当前登录用户添加计划任务
su root
crontab -e
*/1 * * * * echo " hello word" >> /opt/ok //每隔一秒将hello word 写入/opt/ok里
su user1
crontab -e
*/1 * * * * echo "hello friday" >> /opt/ok //每隔一秒将hello friday 写入/opt/ok 里面
crontab -l列出当前登录用户的计划任务
crontab相关目录
/etc/cron.d /etc/cron.monthly
/etc/cron.daily /etc/crontab
/etc/cron.deny /etc/cron.weekly
/etc/cron.hourly
相关文章推荐
- Linux中的计划任务—Crontab调度一次性执行的任务at/batch
- Linux基础之任务计划(at,crontab)
- Linux计划任务(at batch crontab anacron)
- 【Linux】计划任务管理crontab、at
- Linux任务计划at corn及crontab
- Linux系统上的任务计划(at、crontab)的详细使用方法
- linux 任务计划,crontab、at 、anacron
- 定时任务(计划任务)at&crontab
- [9-5]Mail机制和任务计划at、batch、crontab知识梳理和课后练习
- linux中使用at和crontab制定任务计划
- Linux系统任务计划(at、crontab)的使用方法
- Linux系统上的任务计划相关命令at、crontab的使用方法
- Linux计划任务(at batch crontab anacron)
- linux命令:任务计划crontab anacrontab at cron
- Linux计划任务(at,crontab)
- Linux 计划任务at和crontab
- Redhat7.0计划任务服务程序(at,crontab)
- 查看进程以及kill,jobs,fg,bg,计划任务at以及crontab
- Linux入门:计划任务at、crontab
- UNIX/Linux 任务计划at和crontab使用详解