cron job not running

Helmut Schneider jumper99 at gmx.de
Tue May 29 17:11:37 UTC 2012


Patrick Asselman wrote:

> 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.

Yeah, checking the mails, the same that arrive when I cahnge the REGEX.

> 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?

helmut at mail:~$ tail -10 /var/log/cron.log
May 29 19:09:01 mail cron[844]: (*system*) RELOAD (/etc/crontab)
May 29 19:09:01 mail CRON[6912]: pam_unix(cron:session): session opened
for user root by (uid=0)
May 29 19:09:01 mail CRON[6913]: (root) CMD (   aptitude -syV
safe-upgrade | grep -E '^\s+.*$'" > /tmp/whatever.log)
May 29 19:09:01 mail CRON[6912]: pam_unix(cron:session): session closed
for user root
helmut at mail:~$ sudo ls -la /tmp/whatever.log
ls: cannot access /tmp/whatever.log: No such file or directory
helmut at mail:~$





More information about the ubuntu-users mailing list