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

Email script



I'm trying to get one of the Linux boxes I run to send me it's IP address
by Email every time it logs onto the Internet (it has a *!@%* dynamic IP
address). For some reason, the script doesn't work. It creates a file that
contains the data it's supposed to (ipinfo.txt), but I never get the Email.
However, typing 

   mail -s IPINFO tjobrien@traveller.com < /etc/ppp/ipinfo.txt

on the command line causes the mail to be sent.. I'm baffled. Any ideas
what I did wrong? (A copy of the ip-up script follows) 

Thanks, 
Tim  

obriendp : /etc/ppp --> cat ip-up
#!/bin/sh
#
# $Id: ip-up,v 1.1 1996/01/31 21:25:59 alvar Exp $
#
# This script is run by the pppd after the link is established.
# It should be used to add routes, set IP address, run the mailq
# etc.
#
# This script is called with the following arguments:
#    Arg  Name               Example
#    $1   Interface name     ppp0
#    $2   The tty            ttyS1
#    $3   The link speed     38400
#    $4   Local IP number    12.34.56.78
#    $5   Peer  IP number    12.34.56.99

#
# The  environment is cleared before executing this script
# so the path must be reset
#
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
export PATH

ipfwadm -F -a masq -S 192.168.0.0/29 -D 0/0
rm /etc/ppp/ipinfo.txt
clock > /etc/ppp/ipinfo.txt
echo Interface name: $1 >> /etc/ppp/ipinfo.txt
echo Controlling TTY: $2 >> /etc/ppp/ipinfo.txt
echo Link Speed: $3 >> /etc/ppp/ipinfo.txt
echo Local IP Number: $4 >> /etc/ppp/ipinfo.txt
echo Peer IP Number: $5 >> /etc/ppp/ipinfo.txt

mail -s IPINFO tjobrien@traveller.com < ipinfo.txt
 
#last line
--------------------------------------------------------------------
Linux 2.0.6 i486                   Because reboots are for upgrades!
               -------> tjobrien@traveller.com <------
--------------------------------------------------------------------


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: