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"

    Relevant Pages

    • rlogin via expect mysteriously aborts when run from cron
      ... I'm not sure whether this is a problem related to shell, ... I have an application which, at some point, executes a zsh script. ... When investigating the output which was sent to me from the cron job ... I had one case where even a command ...
    • Re: Nmon scheduling question
      ... command ran first then in the script is the ps and kill command so it ... Vince this is a great script. ... Cron Job with pid: 135238 Failed ...
    • SUMMARY: cron entry: nth day of every month?
      ... cron can not handle this with its own syntax. ... 21st but "command" only runs if the output of the "date" command ... What I would suggest is rather than embedding the logic in each script ... The answer is it is _not_ possible to control it only with crontab ...
    • Script wont run from cron
      ... the command line, but the same script fails when running from cron. ... The /bin/sh script runs, but when it goes to fire up the indexing process, ... set, id and limits. ...
    • Re: Cron Job
      ... If you mean the computer itself, put that command ... The standard 'cron' runs jobs at a specific time/date. ... Init or @reboot run jobs when ... Sunday night at 02:00) then copy the script and cron entry. ...