cron job not running

Patrick Asselman iceblink at seti.nl
Tue May 29 17:06:03 UTC 2012


 On Tue, 29 May 2012 16:06:47 +0000 (UTC), Helmut Schneider wrote:
> Hi,
>
> if I put this into /etc/crontab:
>
> *       *       *       *       *       root    aptitude -syV
> safe-upgrade | grep -E '^\s+.*$'"
>
> nothing happens. If I run the same command from dash:
>
> ~$ aptitude -syV safe-upgrade | grep -E '^\s+.*$'
>   libsnmp-base [5.4.2.1~dfsg0ubuntu1-0ubuntu2.1 ->
> 5.4.2.1~dfsg0ubuntu1-0ubuntu2.2]
>   libsnmp15 [5.4.2.1~dfsg0ubuntu1-0ubuntu2.1 ->
> 5.4.2.1~dfsg0ubuntu1-0ubuntu2.2]
>   libssl0.9.8 [0.9.8k-7ubuntu8.11 -> 0.9.8k-7ubuntu8.13]
>   libxml2 [2.7.6.dfsg-1ubuntu1.4 -> 2.7.6.dfsg-1ubuntu1.5]
>   openssl [0.9.8k-7ubuntu8.11 -> 0.9.8k-7ubuntu8.13]
>   snmp [5.4.2.1~dfsg0ubuntu1-0ubuntu2.1 ->
> 5.4.2.1~dfsg0ubuntu1-0ubuntu2.2]
>   snmpd [5.4.2.1~dfsg0ubuntu1-0ubuntu2.1 ->
> 5.4.2.1~dfsg0ubuntu1-0ubuntu2.2]
> ~$
>
> Even if I put those line into a shell-script (dash) it does not give
> any output.
>
> According to cron.log the job should have run:
>
> May 29 17:36:01 desoggw05 CRON[22700]: pam_unix(cron:session): 
> session
> opened for user root by (uid=0)
> May 29 17:36:01 desoggw05 CRON[22701]: (root) CMD (aptitude -syV
> safe-upgrade | grep -E '^\s+.*$')
> May 29 17:36:02 desoggw05 CRON[22700]: pam_unix(cron:session): 
> session
> closed for user root
>
> If I change the REGEX to '^ +.*$' the script runs fine.
>
> Why?
>
> Tested on 10.04 und 12.04.
>
> Thanks, Helmut

 Maybe it did run? Where did you look for output? I would think it ends 
 up in root's mailbox, so maybe a
 sudo cat /var/mail/root
 will reveal something.

 If not, try changing the command to
 aptitude -syV safe-upgrade | grep -E '^\s+.*$'" > /tmp/whatever.log
 at the end of the command, and see what thw logfile gives?

 Best regards,
 Patrick Asselman





More information about the ubuntu-users mailing list