2019-10-12
Views
关于crontab的一些笔记安装
yum install crontabs
systemctl start crond #启动
systemctl status crond #查看状态
使用
crontab -e #进入vi编辑,为当前用户创建定时任务
0 8 * * * /home/wade/test.sh #每天的8:00执行test.sh脚本,前面的是cron表达式:分(0~59) 时(0~23) 日(1~31) 月(1~12) 周(0~6,0表示星期天)
crontab -l #查看任务列表
crontab -r #删除该用户的所有任务
cat /var/spool/mail/用户名 #查看日志
#!/bin/bash
source /etc/profile #加载环境变量配置,防止找不到pt-archiver命令
pt-archiver --source h=i.creekspring.com,P=13326,u=root,p=123456,D=solariot,t=solar_mote --dest h=192.168.0.103,P=3306,u=root,p=H9si0711,D=solariot_archive,t=solar_mote --where 'id>=1' --no-delete --charset=UTF8