crond
Jeff Vian
jvian10 at charter.net
Wed Jan 5 02:09:14 UTC 2005
On Tue, 2005-01-04 at 20:04 -0500, Erik Hemdal wrote:
> >
> > I've written the following script (named checkconn)
> > to be executed every 5 minutes by crond:
> >
> >
>
> . . .
>
> > `/sbin/adsl-stop`
> > `/sbin/adsl-start`
>
> . . .
>
> > 0,10,20,30,40,50 * * * * /root/cron/checkconn
> > 5,15,25,35,45,55 * * * * /root/cron/checkconn
> >
> >
> > Well, if I execute checkconn from the command line,
> > it works as expected, while when checkconn is invoked
> > by crond, it doesn't work...
> >
>
>
> > Any idea?
> > j3d.
> >
>
> Here are a few thoughts. Anything in /sbin is likely to need root privilege
> to run.
> So make sure that you use root's crontab, or place the entries in
> /etc/crontab and specify
> that they run as user root. Also, since cron uses a limited path, make
> certain that
> /root/cron is in the path (add a PATH= line to the crontab entry). Try man
> 8 crontab (IIRC) for information
> on the crontab file format as opposed to the crontab command.
>
1. For Erik:
His command uses the full path. Thus the path comment above is
superfluous.
2. for j3d.
The script being called by cron should contain a shebang line as the
first line. Does it?
it should look like "#! /bin/sh". You can look at any of the scripts
in /etc/init.d to see what should be there.
3. For j3d:
What is the purpose of stop/start the adsl connection every 5
minutes? As I understand it you are simply verifying the connection is
intact. It would make more sense to do a simple ping to some host on
the internet, and if that fails then do the stop/start. Otherwise the
connection is good and you quit.
A drawback to your approach is that the IP address may (and often
does) change when the adsl connection is re-established. If you are
using it the IP change may kick you off, and with a long download that
can be a problem.
More information about the users
mailing list