Chris Dowling <[EMAIL PROTECTED]> writes:
> On Mon, 18 Dec 2000, Johnathan Smith wrote:
>
> > Please help with redhat script
> >
> > I am using redhat 7.0 and I would like to find out how
> > to write a script that I could run in cron.
> >
> > I need the script to get my ip address and then email
> > it to me.
> >
> > This will have me login to my home computer from work.
> >
> > please email me at [EMAIL PROTECTED] if you could help
> >
>
> put the following command in /etc/ppp/ip-up.local
>
> ifconfig ppp0 | grep 'inet addr' | awk -F: '{ print $2 } ' | awk '{ print
> $1 } ' | mail -s 'ip address' [EMAIL PROTECTED]
NOTE: Not absolutely sure this applies to rh7 but.....
If you create the /etc/ppp/ip-up.local script and give it chmod 755
and a shebang like:
#!/bin/sh
That script should automatically be fed a variable that contains your
currently negotiated address. That variable is `$4'.
So no need to poll ifconfig for it.
It should be available with a simple:
echo $4
So your script could be as simple as:
cat /etc/ppp/ip-up.local:
#!/bin/sh
echo $4 |mail -s "Current IP" [EMAIL PROTECTED]
The ip-up.local script is supposed to fire only when a successfull
connection has been negotiated by the ppp daemon. So should contain
the most recent result of those negotiations.
Of course the above relies on you having configed things so that the
`mail' client works.
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list