Re: Cron ?



I tried the following:

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

And when it ran I got the following message:

standard in must be a tty

On Wed, 22 Aug 2007 21:24:05 +0200, Jan Gerrit Kootstra wrote:

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)
  • Re: Cron ?
    ... No standard input is required. ... I suspect the programs problem is with gpg, ... By default cron does not create an user environment. ... I have not tested: cron entry ...
    (linux.redhat)
  • Re: Cron ?
    ... standard in must be a tty ... I have seen this message before when trying to run a script that then ... you must be a tty to type in a password. ... If you ran your cron entry from root's cron, ...
    (linux.redhat)