Re: Re: ipupload
Ciao Eric G . Miller,
> > file to my website. But when I disconnect I can execute another script
> > in ip-down.d because I use 'kill `cat /var/run/ppp0.d`' which is not a
> > proper downing of route ppp0.
>
> Since the ip-down script run *after* the link goes down, you obviously
> can't put the script there.
I have modified ip-up and poff script:
ip-up:
....
# Main Script starts here
run-parts /etc/ppp/ip-up.d
run-parts /etc/ppp/online
Inside online:
/etc/ppp/online$ dir
-rwxrwx--- 1 root dialout 141 May 1 15:11 00*
-rwxrwx--- 1 root dialout 690 Jul 23 14:41 fetchmail*
-rwxr-xr-x 1 root root 327 Oct 6 13:48 postfix*
-rwxrwx--- 1 root dialout 1128 Oct 8 23:48 slrnpull*
-rwxrwx--- 1 root dialout 184 Oct 21 03:06 zz*
so after running programs in ip-up.d, I run programs in online... ***
poff:
...
run-parts /etc/ppp/online
# Lets see how many pppds are running....
#set -- `cat /var/run/ppp0.pid 2>&1 /var/log/PPP.log`
case $# in
0) # pppd only creates a pid file once ppp is up, so let's try killing pppd
...
*** ... the same programs that I run BEFORE killing pppd.
So it works like this:
pon
ip-up.d
* online *
poff
* online *
ip-down.d
If you want to update your network-state on a web-page, using the same
script "/etc/ppp/online/update-my-web-page" you can chek the presence of
ip-up/pon or ip-down/poff in memory:
#!/bin/sh
# update-my-web-page
if [ "`pidof pon`" ] ; then
echo "Going online ..."
/usr/local/script/upload-online-web-page
else
if [ "`pidof poff`" ] ; then
echo "Going offline ..."
/usr/local/script/upload-offline-web-page
else
echo "What are you doing?"
fi
fi
if [ "`pidof gdm`" ] ; then
echo "GDM running ... did you know? :-)"
fi
Ciao
BTW.... I don't like run-parts.
I dont' understand why a so trivial task must be done by a binary.
It' equivalent to 3-line script:
for FILE in `ls /etc/ppp/online` ; do
. /etc/ppp/online/$FILE
done
or no?
--
Paolo Pedaletti, Como, ITALYa
paolo . pedaletti @ flashnet . it
pub 1024D/09120D83 1999-06-11 Paolo Pedaletti (Linux) <paolo.pedaletti@flashnet.it>
Key fingerprint = 0058 45AE B7D3 D603 7D0E D9B8 26E6 01E0 0912 0D83
sub 2048g/F0A8E667 1999-06-11
Reply to:
- References:
- ipupload
- From: "T.V.Gnanasekaran" <gnana@lanminds.com>
- Re: ipupload
- From: "Eric G . Miller" <egm2@jps.net>