APM: Crontab problem
Wayne Walker
wwalker at broadq.com
Sun Jun 29 21:47:55 CDT 2003
On Sun, Jun 29, 2003 at 08:53:51PM -0500, David Murphy wrote:
>
> Im trying to load a script via crontab
>
> The cronttab entry is
>
*/2 * * * * cd /path/to/script && QUERY_STRING='Blah:Blah' ./script.pl
That should do exactly what you want.
in order to test manually rather than wait for cron,:
env -i SHELL=/bin/sh PATH=/usr/bin:/bin PWD=/home/wwalker SHLVL=1 HOME=/home/wwalker LOGNAME=wwalker /bin/sh -c "cd /path/to/script && QUERY_STRING='Blah:Blah' ./script.pl"
Your problems are almost certainly environment variables that you expect
to be set that are not. Your user start up files are NOT read by the
shell that cron execs your program with.
Or the misspelliong of the exported variable. in my method, your only
have to type it once.
> Some varations ive tried are
> 1. Putting the command in a sh file and running that
> 2. */2 * * * * QUERY_STRING='Blah:Blah' ; export QUIERY_STRING ;cd
> /path/to/script ; ./script.pl
> 3. */2 * * * * QUERY_STRING='Blah:Blah' ; export QUIERY_STRING ;cd
> /path/to/script ; perl script.pl
> 4. */2 * * * * QUERY_STRING='Blah:Blah' ; export QUIERY_STRING ;
> perl /path/to/script.pl
> 5. */2 * * * * QUERY_STRING='Blah:Blah' ; export QUIERY_STRING ;
> /path/to/script.pl
> 6. Writing a Perl script that issue system(`QUERY_STRING='Blah:Blah'
> ; export QUIERY_STRING ;cd /path/to/script ; ./script.pl')
>
> None of these work but all of these if put into sh or bash run fine.
>
>
>
> What I get back via a cronemail is variable
>
> But one thing is constant it always in one way or another say file
> not found
>
> Either sh cant find it or perl cant or bin/sh couldn't find it.
>
>
>
> Anyhelp here would be awesome
>
>
>
> And 0755 is the permissions and owner ship of the file it to the user
> running the cron.
--
Wayne Walker
www.broadq.com :) Bringing digital video and audio to the living room
More information about the Austin
mailing list