Advertisement
Guest User

Untitled

a guest
Aug 27th, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.05 KB | None | 0 0
  1. #!/bin/sh
  2. # Copyright 1999-2004 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. #
  5. # Gentoo-specific ifplugd.action
  6. #
  7. # This file gets called by ifplugd when it wants to bring an interface
  8. # up or down.
  9. #
  10.  
  11. if grep -q initng /proc/1/cmdline
  12. then
  13.     EXEC="/sbin/ngc"
  14.     INITNG="yes"
  15. else
  16.     EXEC="/etc/init.d/net.$1"
  17.     INITNG="no"
  18. fi
  19.  
  20. case "$2" in
  21.     up)
  22.         if [ "${INITNG}" = "yes" ]
  23.         then
  24.             ARGS="-u net/$1"
  25.         else
  26.             ARGS="--quiet start"
  27.         fi
  28.         ;;
  29.     down)
  30.         if [ "${INITNG}" = "yes" ]
  31.         then
  32.             ARGS="-d net/$1"
  33.         else
  34.             ARGS="--quiet stop"
  35.         fi
  36.         ;;
  37.     *)
  38.         echo "$0: wrong arguments" >&2
  39.         echo "Call with <interface> <up|down>" >&2
  40.         exit 1
  41.         ;;
  42. esac
  43.  
  44. export IN_BACKGROUND=true
  45.  
  46. if [ -x "${EXEC}" ]
  47. then
  48.     ${EXEC} ${ARGS}
  49.     exit 0
  50. else
  51.     logger -t ifplugd.action "Error: Couldn't configure $1, no ${EXEC} !"
  52.     exit 1
  53. fi
  54.  
  55. # vim: set ts=4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement