I have a user that wants to run a cron job to print a report everyday. User
and root can run the script on the command line and it works just fine but
when it is in users crontab user get the message that the utility in the
script is not found.
Any recommendations on what book will give more information about cron jobs?
Please help.
Hope this helps
Frank
DeifieD schrieb in Nachricht <7k07a5$50v$1...@ffx2nh5.news.uu.net>...
If the script is not in the path then you should e.g. call it something like
this:
/export/home/~user/script.sh
instead of only calling it with the name. script.sh
Hope that helps.
Michael Kalus
DeifieD <eta...@nospam.mc.net> wrote in message
news:7k07a5$50v$1...@ffx2nh5.news.uu.net...
> instead of only calling it with the name. script.sh
BTW: check file attributes (chmod u+x script).
--
Andrzej Bort, bort<at>polsl.gliwice.pl *** My personal opinions ***
gee, thanks :)
>
> > instead of only calling it with the name. script.sh
>
> BTW: check file attributes (chmod u+x script).
I don't think that is the problem as he said he can execute it on the shell.
Michael
You gave me some ideas.
I will try them out.
Kurt J. Lanza wrote in message <3765080B...@inforonics.com>...
Basic point about cron. It does not have the slightest idea about environment.
It is run by the cron daemon which has a basic path, shell and a few other
environment details and thats IT.
It tripped me up many times when learning scripting :)
If you want to execute a script you must make sure that the script itself sets
any environment variables like PATH LPDEST etc, as well as any specific user
variables like MYFILES or DBNAME.
You can do that specifically in the script, or simply source the user's
profile.
in csh its source /full/path/name/.login
in sh or ksh its . /full/path/name/.login
to test that thats the problem, put:
env > /tmp/cronjob.cron
as the first line in the cronjob and have cron kick it off.
then change it to:
env > /tmp/cronjob.cmdline
and run it from the command line.
check out the differences in the environments. Put the missing bits explicitly
in the cronjob.
The moral of the story is: never assume a script inherits the environment you
want it to. Especialy if you run it from cron.
--
/\ The Fulcrum Consulting Group Mark Lambert - Consultant
/\O\ Professional Services For Operation Mark.L...@fulcrum.com.au
/ /\ Of A Networked Computing Environment ph: +61-3-9621-2100
/o | \ 12/10-16 Queen St, Melbourne VIC 3000, Australia fx: +61-3-9621-2724
I think cron should not complain about the password, also crons can be setup
for users also which is probably the cleanest. System upgrades tend to wipe out
the system cron file.