home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / ppp / examples / scripts / ipv6-up.sample < prev    next >
Encoding:
Text File  |  2004-04-12  |  815 b   |  35 lines

  1. #!/bin/sh
  2. #
  3. # This script is called with the following parameters:
  4. # interface tty speed local-address remote-address ipparam
  5. #
  6.  
  7.  
  8. # Start router advertisements on this link.
  9. # Based on radvd 0.5.0 behaviour
  10.  
  11. DEVICE="$1"
  12.  
  13. CFGFILE="/etc/radvd.conf-$DEVICE"
  14. PIDFILE="/var/run/radvd-$DEVICE.pid"
  15. EXEFILE="/usr/sbin/radvd"
  16.  
  17. if [ -x "$EXEFILE" -a -f "$CFGFILE" ]; then
  18.     touch "$PIDFILE"
  19.     if [ ! -f "$PIDFILE" ]; then
  20.     echo "error: $PIDFILE is not a regular file. Aborting"
  21.     exit 0
  22.     fi
  23.  
  24.     PID="$(cat "$PIDFILE")"
  25.     if [ -n "$PID" ]; then
  26.     ps h "$PID" >/dev/null 2>&1 && exit 0
  27.     fi
  28.  
  29.     # radvd 0.5.0 doesn't write a pid-file so we do it here
  30.     # enabling debugging keeps radvd in foreground, putting it
  31.     # on background gives us the PID.
  32.     "$EXEFILE" -d 1 -C "$CFGFILE" &
  33.     echo $! >"$PIDFILE"
  34. fi
  35.