Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

UNIX Scripting FAQ

Tips and Tricks

cron process by cdlvj
Posted: 19 Oct 04 (Edited 19 Oct 04)

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.

Back to UNIX Scripting FAQ Index
Back to UNIX Scripting Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close