home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / dbus-1 / event.d / 25NetworkManager < prev    next >
Encoding:
Text File  |  2007-04-13  |  1.7 KB  |  89 lines

  1. #! /bin/sh
  2. #
  3. # NetworkManager    NetworkManager daemon
  4. #                Daemon for automatically switching network 
  5. #                connections to the best available connection.
  6. #                This file should be placed in /etc/init.d.
  7. #
  8. # Authors:    Christian Bj├ñlevik <nafallo@magicalforest.se>
  9. #            Jan Gerber <j@bootlab.org>
  10. #            Mark Roach <mrroach@okmaybe.com>
  11. #            Thom May <thom@debian.org>
  12. #
  13. # Version:    @(#)skeleton  2.85-23  28-Jul-2004  miquels@cistron.nl
  14. #
  15.  
  16. set -e
  17.  
  18. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  19. DESC="network connection manager"
  20. NAME="NetworkManager"
  21.  
  22. DAEMON=/usr/sbin/$NAME
  23.  
  24. PIDDIR=/var/run/NetworkManager
  25. PIDFILE=$PIDDIR/$NAME.pid
  26.  
  27. SCRIPTNAME=/etc/dbus-1/event.d/25$NAME
  28. USER=root
  29.  
  30. # Gracefully exit if the package has been removed.
  31. test -x $DAEMON || exit 0
  32.  
  33. # We need /sbin/ip
  34. [ -x /sbin/ip ] || exit 1
  35.  
  36. . /lib/lsb/init-functions
  37.  
  38. test -f /etc/default/rcS && . /etc/default/rcS
  39. test -f /etc/default/NetworkManager && . /etc/default/NetworkManager
  40.  
  41. #
  42. #    Function that starts the daemon/service.
  43. #
  44. d_start() {
  45.     if [ ! -d $PIDDIR ]; then
  46.         mkdir -p $PIDDIR
  47.         chown $USER:$USER $PIDDIR
  48.     fi
  49.  
  50.     start-stop-daemon --start --quiet --pidfile $PIDFILE \
  51.         --user $USER --exec $DAEMON -- $DAEMON_OPTS --pid-file $PIDFILE
  52.         
  53. }
  54.  
  55. #
  56. #    Function that stops the daemon/service.
  57. #
  58. d_stop() {
  59.     start-stop-daemon --stop --retry 60 --quiet --pidfile $PIDFILE \
  60.          --oknodo --user $USER --exec $DAEMON
  61.          
  62. }
  63.  
  64.  
  65. case "$1" in
  66.   start)
  67.     log_daemon_msg "Starting $DESC" "$NAME"
  68.     d_start
  69.     log_end_msg $?
  70.     ;;
  71.   stop)
  72.     log_daemon_msg "Stopping $DESC" "$NAME"
  73.     d_stop
  74.     log_end_msg $?
  75.     ;;
  76.   restart|force-reload)
  77.     log_daemon_msg "Restarting $DESC" "$NAME"
  78.     d_stop
  79.     d_start
  80.     log_end_msg $?
  81.     ;;
  82.   *)
  83.     echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
  84.     exit 1
  85.     ;;
  86. esac
  87.  
  88. exit 0
  89.