Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cron process

Tips and Tricks

cron process

by  cdlvj  Posted    (Edited  )
The cron command is the clock daemon that executes commands at specified dates and times.

Question: I developed my script and it runs flawlessly, but when I insert it into the crontab, it fails.

Answer: The cron is executing with the root user id, and your environment is not set up correctly.

Fix: Investigate the use of the user cron feature or use the su command to execute your script. See man su. Essentially cron runs your script under the environment of a user.

Applications and user developed scripts should never be run under root, as they should have their own user environment.

If the script is very complex, you can set up a special user, and code the script in the user profile, then simply log into that user to execute. cron entry simply would be su - <user>. If you look at some of the UNIX special users, you will notice that the OS does it this way.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top