tempfile=/tmp/tempfile.cron
# 將crontab原有的任務copy到tempfile中
crontab -l > $tempfile
# 把將要執行的任務追加到上一步得到的文件中
echo "0 0 * * * /clear.sh 1>/dev/null" >> $tempfile
# 將上一步得到的文件中的所有任務導入crontab中
crontab $tempfile
service crond restart
rm -f $tempfile