diff options
author | Patrick J Volkerding <volkerdi@slackware.com> | 2013-11-04 17:08:47 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2018-05-31 22:57:36 +0200 |
commit | 76fc4757ac91ac7947a01fb7b53dddf9a78a01d1 (patch) | |
tree | 9b98e6e193c7870cb27ac861394c1c4592850922 /source/n/NetworkManager/rc.networkmanager | |
parent | 9664bee729d487bcc0a0bc35859f8e13d5421c75 (diff) | |
download | current-76fc4757ac91ac7947a01fb7b53dddf9a78a01d1.tar.gz |
Slackware 14.1slackware-14.1
Mon Nov 4 17:08:47 UTC 2013
Slackware 14.1 x86_64 stable is released!
It's been another interesting release cycle here at Slackware bringing
new features like support for UEFI machines, updated compilers and
development tools, the switch from MySQL to MariaDB, and many more
improvements throughout the system. Thanks to the team, the upstream
developers, the dedicated Slackware community, and everyone else who
pitched in to help make this release a reality.
The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a
dual-sided
32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware
project by picking up a copy from store.slackware.com. We're taking
pre-orders now, and offer a discount if you sign up for a subscription.
Have fun! :-)
Diffstat (limited to 'source/n/NetworkManager/rc.networkmanager')
-rw-r--r-- | source/n/NetworkManager/rc.networkmanager | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/source/n/NetworkManager/rc.networkmanager b/source/n/NetworkManager/rc.networkmanager new file mode 100644 index 00000000..430e61a4 --- /dev/null +++ b/source/n/NetworkManager/rc.networkmanager @@ -0,0 +1,105 @@ +#!/bin/sh +# +# NetworkManager: NetworkManager daemon +# +# description: This is a daemon for automatically switching network \ +# connections to the best available connection. \ +# +# processname: NetworkManager +# pidfile: /var/run/NetworkManager/NetworkManager.pid +# + +prefix=/usr +exec_prefix=/usr +sbindir=${exec_prefix}/sbin + +NETWORKMANAGER_BIN=${sbindir}/NetworkManager + +# Sanity checks. +[ -x $NETWORKMANAGER_BIN ] || exit 0 + +PIDFILE=/var/run/NetworkManager/NetworkManager.pid + +nm_start() +{ + if [ "`pgrep dbus-daemon`" = "" ]; then + echo "D-BUS must be running to start NetworkManager" + return + fi + + # Just in case the pidfile is still there, we may need to nuke it. + if [ -e "$PIDFILE" ]; then + rm -f $PIDFILE + fi + + echo "Starting NetworkManager daemon: $NETWORKMANAGER_BIN" + $NETWORKMANAGER_BIN +} + +nm_status() +{ + local pidlist=`cat $PIDFILE 2>/dev/null` + if [ -z "$pidlist" ]; then + return 1 + fi + local command=`ps -p $pidlist -o comm=` + if [ "$command" != 'NetworkManager' ]; then + return 1 + fi +} + +nm_stop() +{ + echo -en "Stopping NetworkManager: " + # Shut down any DHCP connections, otherwise the processes will be orphaned + # and the connections will not come up when NetworkManager restarts. + if ps ax | grep /sbin/dhcpcd | grep -q libexec/nm-dhcp ; then + ps ax | grep /sbin/dhcpcd | grep libexec/nm-dhcp | while read line ; do + kill -HUP $(echo $line | cut -b 1-5) + done + fi + if ps ax | grep /sbin/dhclient | grep -q /var/lib/NetworkManager ; then + ps ax | grep /sbin/dhclient | grep /var/lib/NetworkManager | while read line ; do + kill -HUP $(echo $line | cut -b 1-5) + done + fi + local pidlist=`cat $PIDFILE 2>/dev/null` + if [ ! -z "$pidlist" ]; then + kill $pidlist &>/dev/null + sleep 3 + rm -f $PIDFILE &>/dev/null + fi + echo "stopped"; + sleep 3 +} + +nm_restart() +{ + nm_stop + nm_start +} + +case "$1" in +'start') + if ( ! nm_status ); then + nm_start + else + echo "NetworkManager is already running (will not start it twice)." + fi + ;; +'stop') + nm_stop + ;; +'restart') + nm_restart + ;; +'status') + if ( nm_status ); then + echo "NetworkManager is currently running" + else + echo "NetworkManager is not running." + fi + ;; +*) + echo "usage $0 start|stop|status|restart" +esac |