linux 通过脚本设定时任务

1.linux 下添加定时任务

网上有很多定时任务的介绍,本篇主要介绍通过脚本添加定时任务的操作。
1.编写crond 需要的执行的脚本:
example.sh
echo "haha"

2. 编写cron 执行的脚本,example
1 * * * * root example.sh > /dev/null 2>&1

3. 在安装脚本 install.sh 中,将example 拷贝到/etc/cron.d中
cp -f example.sh /etc/crod.d/

执行:
crontab /etc/cron.d/example

~~~~~
原文地址:https://www.cnblogs.com/missmzt/p/5046123.html