0

从系统日志

May  8 01:00:01 mvtspro-main /USR/SBIN/CRON[22645]: (root) CMD (/usr/local/ky4k0b/cdrs_backup_daily.sh)
May  8 01:00:01 mvtspro-main /USR/SBIN/CRON[22638]: (CRON) error (grandchild #22645 failed with exit status 12)

从 /etc/crontab

mvtspro-main:/cdrs/backup# cat /etc/crontab
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
25 6    * * *   root    ntpdate pool.ntp.org
0 1 * * *       root    /usr/local/ky4k0b/cdrs_backup_daily.sh
0 2 1 * *       root    /usr/local/ky4k0b/cdrs_backup_monthly.sh
0 3 1 * *       root    /usr/local/lib/mvtspro/backupdb.php

我的脚本

mvtspro-main:/cdrs/backup# cat /usr/local/ky4k0b/cdrs_backup_daily.sh
#!/bin/sh
mask=`date --date="yesterday" +%Y%m%d\*`
arch_name=`date --date="yesterday" +%Y%m%d`
find /cdrs -type f -name "$mask"|zip -m /cdrs/backup/$arch_name.zip -@

我在哪里做错了?谢谢!PS:如果我手动运行此脚本,它工作正常。

4

2 回答 2

0

I remember having the same problem with cron. In my case it was excessive output from tar not getting directed anywhere so it would block the script after the buffer ran full. Redirecting output of the called script to /dev/null worked for me (or maybe it was setting MAILTO="").

于 2013-05-08T15:58:15.353 回答
0
/etc/init.d/cron restart

这行得通

于 2014-09-04T12:03:49.550 回答