ip-up-EXAMPLE 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. #
  3. # This file was created when you ran 'ppp -s'.
  4. #
  5. # This file /etc/ppp/ip-up is run by pppd when there's a successful ppp
  6. # connection.
  7. #
  8. # Put any commands you want run after a successful connection in this file.
  9. #
  10. # The companion file is /etc/ppp/ip-down, it's run when the ppp connection
  11. # ends.
  12. #
  13. # The environment is cleared before executing this script so the path must
  14. # be reset.
  15. #
  16. PATH=/usr/bin:/usr/sbin:/usr/X11R7/bin:/sbin:/bin
  17. export PATH
  18. # This will print to the screen the local & remote ip address when you
  19. # make a successful ppp connection.
  20. # $4 = Local IP $5 = Remote IP
  21. #
  22. # The CARRIER speed at which you connect will be reported if your modem
  23. # reports it.
  24. #
  25. # You may have to add W2 or S95=1 to your modem init string to get your
  26. # modem to report the DCE = CARRIER speed.
  27. # Examples: AT&FW2 or AT&FS95=1
  28. [ ! -z $DNS1 ] && echo "nameserver $DNS1" > /etc/resolv.conf
  29. [ ! -z $DNS2 ] && echo "nameserver $DNS2" >> /etc/resolv.conf
  30. CS="`grep CONNECT /var/log/report-chat 2>/dev/null | cut -b 24-40 2>/dev/null`"
  31. if (echo "$CS $4 > $5 $1" | /usr/X11R6/bin/xmessage -display $HOSTNAME:0.0 -file - 2>/dev/null); then
  32. :
  33. else
  34. echo "$CS $4 > $5 $1" >/dev/tty0
  35. fi
  36. #End!