Re: Cron ?



Terry A Haimann wrote:
Is there something different about running a job in cron then there is
from a command prompt. I have a FreePascal created program that crashes
when I run it from cron, but works normally when submitted from bash. This program is starting several other programs (If that makes any
difference.)

Thx, Terry
Terry,


Does your program require environment variables to be set before running the program itself?

By default cron does not create an user environment.

To set an user environment I use a script,say cron-pascal-program.sh with a content like:

su - user -c /path/your-FreePascal-program


and the cron entry like:

0 0 * * * /path-to/cron-pascal-program.sh


Other option, I have not tested: cron entry

0 0 * * * /bin/su - user -c /path/your-FreePascal-program

This way your user environment is set at runtime of the Pascal program.


Best regards,


Jan Gerrit Kootstra
.



Relevant Pages

  • Re: Cron ?
    ... Terry A Haimann wrote: ... By default cron does not create an user environment. ... I have not tested: cron entry ... Does this program need standard input? ...
    (linux.redhat)
  • Cron jobs and Users
    ... I have a user who has scheduled a cron job to run hourly. ... It is a script to move and compress some logs, but these files are not being created and I am at a loss as to why this isn't working: ... There is an entry in /var/cron/log on the relevant times to show the job is being executed, but the new files are still not being created. ... I have copied and pasted the cron entry in root's crontab, ...
    (comp.unix.solaris)
  • RE: Cron not working
    ... You might want to post your cron entry. ... I have checked the log files and no errors in there. ... Is the tomcat user allowed to use cron on that box? ...
    (RedHat)
  • Re: Cron Problem
    ... Cron runs as another service in the background ... and is meant to kick off backup scripts and the like. ... when you get ready to do something and a cron entry just happens to run. ... your xmms process is probably getting started but is not going ...
    (alt.os.linux.suse)
  • Re: Cron jobs and Users
    ... The cron entry is formatted correctly ... Verify that the script does not assume a particular PATH. ... Verify that the script does not assume a particular environment. ...
    (comp.unix.solaris)