crond

Gene Heskett gene.heskett at verizon.net
Wed Jan 5 07:14:45 UTC 2005


On Wednesday 05 January 2005 01:18, Giuseppe Greco wrote:
>On Tue, 2005-01-04 at 20:09 -0600, Jeff Vian wrote:
>> 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:
>> >

First off, one post is sufficient, I ahve 4 identicals showing in the 
inqueue right now.

>> > . . .
>> >
>> > >     `/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...

Thats because your script doesn't tell cron howto execute it.
When you exec it from the cli, the shell (probably bash) interprets it 
and everything is fine.  But when cron looks at it, it hasn't the 
foggiest who to hand it to since bash or /bin/sh if you will, is no 
more preferable than perl, python, ruby, regina or tcl/tk.

To do this, the first line of your script needs to be

#!/bin/sh

and then append the rest of your stuff in subsequent lines.
>> > >
>> > >
>> > >
>> > > 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.
>
>Often the pppoe connection stops working even if pppd is still
> running, and then I'm not able to access the Internet anymore. When
> that happens, the only thing I can do is to restart the ppp0
> interface...
>
>I'm trying to figure out the source of the problem, but till now no
>way...
>
>j3d.
>
>
>
>
>--
>----------------------------------------
>Giuseppe Greco
>
>::agamura::
>
>phone:  +41 (0)91 604 67 65
>mobile: +41 (0)79 602 99 27
>email:  giuseppe.greco at agamura.com
>web:    www.agamura.com
>----------------------------------------

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.31% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attorneys please note, additions to this message
by Gene Heskett are:
Copyright 2004 by Maurice Eugene Heskett, all rights reserved.




More information about the fedora-list mailing list