in reply to Re^2: Twig in a crontab?
in thread Twig in a crontab?

You can set environment variables at the beginning of the crontab file; cron will automatically export these to your script's environment. Like so:
LD_LIBRARY_PATH=/usr/sfw/lib


If you want to improve, be content to be thought foolish and stupid. -- Epictetus

Replies are listed 'Best First'.
Re^4: Twig in a crontab?
by BenHopkins (Sexton) on Jan 31, 2008 at 06:47 UTC
    That may be true for Linux or OS-X, but not for Solaris, which is what I'm working on.

      Then call a script instead.

      #!/bin/ksh LD_LIBRARY_PATH=.... export LD_LIBRARY_PATH cd /dir/where/you/want/to/start exec commandtorun param1 param2 ...

      Update: Added exec - saves one process in the process table.

      and call it from your crontab instead of the command you are calling right now.

      You can also do on the crontab line

      0 0 * * * LD_LIBRARY_PATH=foobar commandtorun param1 param2

      Also make certain that you have your CWD properly accounted for from cron. I will often do a cd /dir/to/run/from && command... as part of my cron line.

      --MidLifeXis