[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatic dialing



On Fri, May 28, 1999 at 11:16:21AM +0530, pankaj_a wrote:
> #!bin/bash
> wvdial
> /usr/sbin/sendmail -q -v  $*
> /usr/bin/fetchmail -k -a -v -d 0 -N
> sleep 5
> killall pppd
> killall wvdial
> 
> Now there is a TWO case
> 1;   when I control this process by "crond" configured through linuxconf
> then
>      modem is dialing perfect at proper time shedule  but next proceses i.e.
> a) sending mails b)fatching mails  c)  stoping wvdial & pppd. is not going
> on I mean to say that sendmail, fetchmail etc r not executing .

Does cron mail you any output?
If not, try adding this to the top of the script after #!/bin/bash:
   set -x
The script should print a line for each command it executes, and this should
be mailed to you.

There are some possible problems I can see:

(1) I would drop the '$*' from the sendmail command line. I am not sure what
this will expand to when the job is run under cron, but it is quite likely
to generate a sendmail error. When run under an interactive shell it will
expand to whatever parameters you gave to the script (i.e. usually empty)

(2) Where is your .fetchmailrc? Are you running this script as root, then
you need /root/.fetchmailrc

(3) I have never used wvdial. But are you _sure_ that it doesn't continue
until after pppd has actually completed negotiating a working session? If it
terminates when pppd has started but it has not finished negotiating the
link, then sendmail and fetchmail will both be unable to reach the Internet
(no defaultroute will have been installed).

To test this theory, try modifying your script as:

wvdial
echo "Routing table after wvdial"
netstat -rn
sleep 15
echo "Routing table after 15 seconds"
netstat -rn

Check for defaultroute (0.0.0.0). If it doesn't exist in the first entry but
it does in the second, then there's your problem.

You can either work out what is an optimal value of 'sleep', or you can
write a script to wait until defaultroute has appeared.

(4) A problem which often occurs with cron jobs is that the PATH environment
variable is set differently, but since you have explicitly given the path to
sendmail and fetchmail, that shouldn't be a problem.

Regards,

Brian.