#! /bin/sh # # NetworkManager NetworkManager daemon # Daemon for automatically switching network # connections to the best available connection. # This file should be placed in /etc/init.d. # # Authors: Christian Bjälevik # Jan Gerber # Mark Roach # Thom May # # Version: @(#)skeleton 2.85-23 28-Jul-2004 miquels@cistron.nl # set -e PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="NetworkManager daemon" NAME="NetworkManager" DAEMON=/usr/sbin/$NAME PIDDIR=/var/run/NetworkManager PIDFILE=$PIDDIR/$NAME.pid SCRIPTNAME=/etc/dbus-1/event.d/25$NAME USER=root # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 # We need /sbin/ip [ -x /sbin/ip ] || exit 1 . /lib/lsb/init-functions test -f /etc/default/rcS && . /etc/default/rcS test -f /etc/default/NetworkManager && . /etc/default/NetworkManager # # Function that starts the daemon/service. # d_start() { log_begin_msg "Starting $DESC" if [ ! -d $PIDDIR ]; then mkdir -p $PIDDIR chown $USER:$USER $PIDDIR fi modprobe capability >/dev/null 2>&1 || true test -d /var/lib/NetworkManager || mkdir -p /var/lib/NetworkManager chmod 755 /var/lib/NetworkManager start-stop-daemon --start --quiet --pidfile $PIDFILE \ --user $USER --exec $DAEMON -- $DAEMON_OPTS --pid-file $PIDFILE log_end_msg $? } # # Function that stops the daemon/service. # d_stop() { log_begin_msg "Stopping $DESC" start-stop-daemon --stop --retry 60 --quiet --pidfile $PIDFILE \ --oknodo --user $USER --exec $DAEMON log_end_msg $? } case "$1" in start) d_start ;; stop) d_stop ;; restart|force-reload) d_stop d_start ;; *) log_success_msg "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0