Re: Script help...............
Michael Beattie wrote:
> On Mon, 26 Oct 1998, Phillip Neumann wrote:
>
> > Hi debian world...
> >
> >
> >
> >
> > Im not know very much about scripts so i need some help with one..
> >
> > Here my situation:
> >
> > A script will be executed when i call to my linux box... here it is:
> >
> > /etc/init.d/xringd stop
> > /root/IP_MAIL
> > pon incomingcall <--------------------
> > /etc/init.d/xringd start |
> > |
> > |
> >
> > This has the -detach option so i can kill it and the script will continue...
> >
> >
> >
> > Now, i have problems with /root/IP_MAIL, becouse it try to send me my ip number before i can get one... this is how IP_mail looks:
> >
> > 1)DAY=$(date +%A)
> > 2)NUMBER=$(date +%d)
> > 3)TIME=$(date +%r)
> > 4)MONTH=$(date +%m)
> > 5)IP=$(/sbin/ifconfig | grep inet | awk '{print $2}' |awk -F: '{print $2}' | grep -v 127)
> > 6)echo "Today, $DAY $NUMBER/$MONTH [$TIME] you have got an ip address: $IP" > /tmp/iptemporal.tmp
> > 7)mail -s "Identidad: $IP" filsin@innocent.com < /tmp/iptemporal.tmp
> >
> >
> > in filsin@innocent.com i get:
> > Today, Monday 26/10 [07:45:12 PM] you have got an ip address:
> >
> >
> > so how can i make IP_MAIL do 1,2,3,4 and 5 until $IP is not empty ?? (is $IP is not empty then go on and send the mail...)
> >
>
> Hmmm, What you need, is a script in /etc/ppp/ip-up.d/ to do this, but only
> when 'pon incomingcall' is executed.. change your first script thus:
>
> /etc/init.d/xringd stop
> touch /tmp/make_IP_available
> pon incomingcall
> rm /tmp/make_IP_available
> /etc/init.d/xringd start
>
> place your second script in /etc/ppp/ip-up.d/ and start it with:
>
> #!/bin/sh
> test -f /tmp/make_IP_available || exit 0
> ...
>
> so if the first script was called, it creates a temporary 0 byte file,
> that the second script checks for. If it exists, it mails you with the IP
> Address.
>
> Michael Beattie (mickyb@es.co.nz)
>
> PGP Key available, reply with "pgpkey" as subject.
> -----------------------------------------------------------------------------
> "Bother," said Pooh, as the rip cord came away in his hand
> -----------------------------------------------------------------------------
> Debian GNU/Linux.... Ooohh You are missing out!
Hello
Well thanks, i finnaly got this working 8-]
bye,
--
__________________________________________
/ /
/ Phillip Neumann /
/ filsin@bigfoot.com /
_____________________/_____________________________/
Reply to: