Re: Cron ?



botsali@xxxxxxxxx wrote:
Hi ,
Normally bash is interactive environment.
But cron is not.
You may need to redirect output of your script
to somewhere for example
You can add >/dev/null 1>&2 en of your cronjob.
Hope it helps.



On 22 A ustos, 22:24, Jan Gerrit Kootstra <jan.ger...@xxxxxxxxxxxxxxx>
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



Botsali,


You do not need to redirect the output, it will be mailed to the user owning the crontab.

It is good practise to redirect I agree, but it is not needed.


Kind regards,


Jan Gerrit Kootstra
.



Relevant Pages

  • Re: Cron ?
    ... Normally bash is interactive environment. ... But cron is not. ... By default cron does not create an user environment. ...
    (linux.redhat)
  • Re: Change cron output to other user
    ... moonhk wrote: ... If you want to redirect mail from your account to another account, ... That will redirect all mail. ... Cron sends mail to the user who ows the crontab file ...
    (comp.unix.solaris)
  • Re: System Time, where does it come from?
    ... it would be perfectly understandable if the hardware time was set to ... Simply looking in the cron log ... The crontab -l command was executed from your shell, ... environment or your cron daemon's environment that disagrees about ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Cron question
    ... You can test things by doing an "su gs -c /bin/sh" from a root login and then trying to run your wrapper, which will give you a minimum environment closer to what cron executes under. ... SVN_EDITOR => vim ...
    (freebsd-questions)
  • Re: Change cron output to other user
    ... Nathan Dietsch wrote: ... That will redirect all mail. ... Cron sends mail to the user who ows the crontab file ... We using other SMTP server to send mail. ...
    (comp.unix.solaris)