非交互式管理crontab

添加一个crontab 

[root@mysql-master ~]# (crontab -l;echo "*/2 * * * * /usr/sbin/ntpdate time1.aliyun.com >/dev/null 2>&1") | crontab
[root@mysql-master ~]# crontab -l
*/2 * * * * /usr/sbin/ntpdate time1.aliyun.com >/dev/null 2>&1

删除一个crontab

 [root@mysql-master ~]# crontab -l | grep -v "ntpdate" | crontab
[root@mysql-master ~]# crontab -l

猜你喜欢

转载自blog.csdn.net/weixin_42123737/article/details/82387787