Script not working on cron


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 -s "Checkfiles" -b -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/ > /home/user/cronlog.txt has permissions 777

Any idea?

Thanks in advance,

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,