Re: cron script won't run

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 26 September 2006 10:30 Adam T. Bowen's cat, walking on the 
keyboard, wrote:
> Hi,
>
> Matthew Metzger wrote:
> > I have a script that works great when I run it from the command line,
> > but doesn't work at all when added to crontab.
>
> # cat /dev/sysadm/mantra
> The environment from within cron is not necessarily the same as that of
> an interactive shell.

It is possible to specify environment variables in the crontab file, thus to 
create an environment similar to the one the user work in interactive mode:

[t35@server 35]$ crontab -l
PATH=/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt
BASH_ENV=$HOME/.bashrc
LPDEST=stt35
MAIL=/var/mail/t35
USERNAME=""
DFENV=/home/t35/dfenv.cfg
TERMINFO=/usr/share/terminfo
DFTERMINFO=/vol1/df31d/lib/terminfo
LINES=25
COLS=80
USER=t35
DFUSER=35

10 21 * * 1-6 /your/crontab/job


Also making into your script a redirection to a log file could help finding 
out what is the problem.

Luca
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux