I have written a very simple bash script that runs on Solaris10. It runs a command and then sends me the output via mailx. I can run it at the command line (sudoed as root) and it runs perfectly fine. I then set it up to run from root's cron. I will get an email with the expected subject, but no text in it (i.e. output from the command), and I can then verify the commands have not executed. Why is this not working correctly via root's cron, but works fine via the shell?

It could be a multitude of things including:
1) the file is not in the expected directory when the program runs
1a) the program is running from a different directory than what you use manually.

2) The cron shell is not the same as your manually logged-in shell
2a) ...so the path might not be the same

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.