shell 中的crontab
来源:互联网 发布:判断上三角矩阵 编辑:程序博客网 时间:2024/06/10 23:47
Crontab计划任务
-->周期性执行计划任务
选项使用:
crontab -l (list ) #查看目前的计划任务列表
crontab -r (remove) #删除计划任务
crontab -e (eidt) #编辑周期性计划任务
进程名称是crond
ps -ef | grep crond $查看此进程是否开启
默认进程是开启的,如果没有开启,可以使用命令手动开启
# service crond status
# service crond start
# service crond stop
# service crond restart
# 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
* * * * *
分钟 小时 天(of月) 月(of年) 星期(of周)
每天晚上18:00执行一次拷贝/home/uer01/2.log文件到/opt/software的任务
0 18 * * * /bin/cp /home/uer01/2.log /opt/software
15 18 * * * /bin/cp /home/uer01/2.log /opt/software
每天晚上6点到第二天早上6点 每15分钟记录一次时间到/home/uer01/2.log文件中
*/15 18-23,0-6 * * * /bin/date >> /home/user01/2.log
0,15,30,45 18-23,0-6 * * * /bin/date -R >> /home/user01/2.log
注意:如果是离散的值,使用“,”进行分割
如果是连续的值,使用“-”进行连接
0 6-12/2 * * 7 /bin/sh /home/user01/datelog.sh
datelog.sh
#!/bin/sh
/bin/echo "当前时间是:" >> /home/user01/2.log
/bin/date -R >> /home/user01/2.log
-->周期性执行计划任务
选项使用:
crontab -l (list ) #查看目前的计划任务列表
crontab -r (remove) #删除计划任务
crontab -e (eidt) #编辑周期性计划任务
进程名称是crond
ps -ef | grep crond $查看此进程是否开启
默认进程是开启的,如果没有开启,可以使用命令手动开启
# service crond status
# service crond start
# service crond stop
# service crond restart
# 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
* * * * *
分钟 小时 天(of月) 月(of年) 星期(of周)
每天晚上18:00执行一次拷贝/home/uer01/2.log文件到/opt/software的任务
0 18 * * * /bin/cp /home/uer01/2.log /opt/software
15 18 * * * /bin/cp /home/uer01/2.log /opt/software
每天晚上6点到第二天早上6点 每15分钟记录一次时间到/home/uer01/2.log文件中
*/15 18-23,0-6 * * * /bin/date >> /home/user01/2.log
0,15,30,45 18-23,0-6 * * * /bin/date -R >> /home/user01/2.log
注意:如果是离散的值,使用“,”进行分割
如果是连续的值,使用“-”进行连接
0 6-12/2 * * 7 /bin/sh /home/user01/datelog.sh
datelog.sh
#!/bin/sh
/bin/echo "当前时间是:" >> /home/user01/2.log
/bin/date -R >> /home/user01/2.log
阅读全文
0 0
- shell 中的crontab
- crontab不能执行shell中的mysql命令
- shell中的一些后台执行命令(crontab/at/&/nohup)
- shell-crontab快速手册
- shell-crontab快速手册
- Shell脚本修改crontab
- 用shell修改crontab
- shell之crontab
- shell之Crontab介绍
- Shell crontab 使用
- shell定时器-crontab
- 使用Linux的crontab调用shell中的scp自动备份mysql数据
- Linux下使用crontab调用shell中的scp自动备份mysql数据
- 使用Linux的crontab调用shell中的scp自动备份mysql数据
- crontab 定时执行shell脚本
- crontab 定时执行shell脚本
- shell-crontab(定时调度)
- crontab启动shell,环境变量问题
- 判断
- 暑假集训 第二周 周四( 忘了第几天了 )
- 技术指南:服务器身份证识别银行卡识别
- 安卓6.0以后动态申请权限
- Java集合---LinkedList源码解析
- shell 中的crontab
- Dynamic Proxy(动态代理)
- PHP源码编译pdo、pdo_mysql
- Varnish的配置语言VCL及其内置变量介绍
- 示波器界面的中英文切换
- Mysql安装时出现APPLY security settings错误
- 清橙A1235(BZOJ2147) Digit(蒋中天)
- java该怎么学
- vim 一些快捷使用技巧