German Guillot wrote:
On Wed, 04 Aug 2004 11:34:36 -0500, Mikkel L. Ellertson <[EMAIL PROTECTED]> wrote:


You might want to try adding a PATH=<whatever your path is> before
the first command in the script.


Yep, I did that. I tried PATH=/home/ger/bin and when that didn't work
PATH=/bin:/usr/bin:/usr/bin/X11: etc, the whole bash environment variable.


Did you add the full path in the script, or in the crontab entry? I find specifing the path the script expects in the script itself cuts way down on problems, especialy if you later change your path from what it was when you wrote the script. You can usualy depend on /bin;/usr/sbin, but anything else depends on how the script is being run.

I am not sure how you added the path to the crontab entry, but it
doesn't sound like your script is using it.


I created a file in my home dir called "crontab", and then did
crontab crontab. The new generated file appeared as
/var/spool/cron/ger, and crontab -l showed its contents properly.


If it is using the default path, then it will not find any programs
that are not in /bin or /usr/bin.  A couple of other things to be
carefull of

- some programs do not work well if you do not have an active
ternimal. - when run by crontab, you have a very limmited set of
varables set.


Just to see, I made another script to open a browser window. All it
has is this:

#!/bin/bash galeon

It's called /home/ger/bin/gal and works from the command line. But
not from cron. Those things you point out might be the reason... I'll
use a command that always works and check it. Any suggestions?

I bet it will not work from the command line if you are at the command line interface, instead of the command line in an xterm. Any command that needs X to run will NOT work in a cron job. This is because it can not connect to an X server - at least not with the default security settings. It is not a good idea to change the settings to allow this, unless you are on an isulated machine. (I remember playing tricks on people running an open X server...) ;)


If you would post your crontab entry, and your script, we may be
able to give you more specific help.  (Any error mail from crontab
also...)


[EMAIL PROTECTED] ger]$ crontab -l # DO NOT EDIT THIS FILE - edit the
master and reinstall. # (crontab installed on Wed Aug 4 18:50:32
2004) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37
vixie Exp $) SHELL=/bin/bash MAILTO=ger PATH=/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin:/opt/X11R6/bin:/usr/bin:/usr/games:/usr/lib/jre-1.4.2_04/bin:/home/ger/bin



*/15 * * * * /home/ger/bin/gal

That's the current content. Tha actual script I'm trying to run is an
 adaptation of Todd Slater's recently posted script to check a web
page for new content. The only differences being that wget reads my
galeon cookie file (it's a site that requires login) and that if
there is any change Galeon opens a tab in the background. As I said,
from the command line it works.

Incidentally, about the mail. I've been looking for it, but I didn't want to ask different kinds of questions in the same email. The directory /var/spool/mail/ is empty and there's no mail-related stuff
in my home dir. I've never yet read system mail so I don't know if there's a deamon that should be running and isn't, or something.


Anyway, good pointers there, I'll try with other simple commands to see what happens. Thanks a lot.

Germán.

I hope this helps...

Mikkel
--

  Do not meddle in the affairs of dragons,
for you are crunchy and taste good with Ketchup!

____________________________________________________
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________

Reply via email to