Script runs from shell not from Cron

Hi

I have a script called changepermission.sh
I want to cron it once a day. The script runs fine from the shell with:
sh changepermission.sh

From the cron, it never seems to run. I use absolute path when I am refering to it:

          • /cronjobs/changepermission.sh
            (i made it run every minute to test)

Any ideas?

Is it chmod+x’d (executable)?

Is it running but unable to do whatever’s inside changepermission.sh because either the cron user doesn’t have permission or the commands are not in the PATH of the cron user?

Thanks for your response. I am trying to change ownership of certain directory on the server. Perhaps cron user I am using doesn’t see this directory? How can I run it as a super admin the cron job or give access to the directory.

Thanks,
Chris

I would lean towards a permission problem somewhere (wish I could tell you where :)). I have spent hours and hours tracking down which part of the script wasn’t being allowed to execute. PITA.

Do you use absolute paths to all excutables in the script?

So instead of “sh” use “/bin/sh” etc

Almost every problem I had with cron jobs not running was caused by this …

This is bacause the user running the cron has another (or no) PATH set than you (even when “your user” is running it)