Script not working on cron

Script not working on cron

Posted by: JAG
Posted on: 2007-04-15 03:31:00

Hello,

I have a small script that runs fine from the terminal but it doesn't seem to work when launched by the cron process.

I'm sure that cron is working because it updates my awstats periodically without problems.

This is my script:

/bin/ls -l /home/user/userdata/ | /usr/bin/cut -c30-35,49-100 | /bin/grep -e "[[:space:]]0[[:space:]]" | /usr/bin/mail email@domain.com -s "Checkfiles" -b logs@mydomain.com -e

It emails the filenames that has no contents (file size = 0)

As you can see I added the full path to every command but it doesn't seem to work.

The crontab:

0 0,7 * * * /bin/sh /home/user/userdata/check_files.sh > /home/user/cronlog.txt

check_files.sh has permissions 777

Any idea?

Thanks in advance,
Jose

Re: Script not working on cron

Posted by: JAG
Posted on: 2007-04-16 01:33:00

Ok, I figure it out!

It seems that the output format of "ls -l" is different when is executed by crond, so the cut section was failing and therefore no email was being sent.

Thanks anyway,
Jose

Tags: usr bincronmailemail domainmydomainawstatscrontabgrepperiodicallylogssh