Cron entry & .profile question

From: Linnabary, Paul (
Date: 06/09/04

  • Next message: Vishal Gupta: "Sun Traffic Manager question"
    Date: Wed, 9 Jun 2004 15:12:13 -0500
    To: <>


    Cron jobs can be confusing at times. When I run a script I wrote from
    the command line, it runs perfectly. When I run it as a root cron job
    each night, it does not do what it is supposed to do. I get a root
    email message each morning telling me what went wrong. Without going
    into the details of the error, I do know that to fix it, I need to
    correctly get the .profile of the user account that owns this script
    into my script. Sun document #5838 regarding "how to include a .profile
    or .login in cron execution" states cron runs using the bourne shell.
    The bourne shell uses the command "." to mean execute the following file
    in the current shell. This is equivalent to the csh "source" command.
    The usage to include the .profile (or .login ) file is [cron time
    entries] . $HOME/.profile ;[other sh commands]. The file being included
    must consist of bourne shell commands. This is all a bit confusing to
    me. Should I run my cron job as root or should I make a new cron entry
    for the user account that owns the script. This user is set up with
    /bin/ksh. If it is okay to just run this script with a root cron entry,
    please advise as to where I need to make this $HOME/.profile line entry.
    Would it go in the script I am running or on the cronjob entry line?
    Thanks! Paul in Kansas
    sunmanagers mailing list

  • Next message: Vishal Gupta: "Sun Traffic Manager question"