日期:2014-05-16 浏览次数:20684 次
比较简单,这样就可以了
cat > /var/spool/cron/root <<EOF
* * * * * /usr/sbin/ntpdate cn.pool.ntp.org >> /var/log/ntpdate.log
EOF
?
?
?
项目中的应用:
config.sh
---------------------------------------------------
crontabfile=/var/spool/cron/mysql
if [ -e $crontabfile ]; then
echo "*/10 * * * * /home/mysql/PEnterAccount/DaemonPEnterAccount.sh" >>$crontabfile
else
touch $crontabfile
echo "*/10 * * * * /home/mysql/PEnterAccount/DaemonPEnterAccount.sh" >>$crontabfile
fi
service crond restart