source: trunk/third/ifplugd/conf/ifplugd.init.in @ 22250

Revision 22250, 2.9 KB checked in by ghudson, 19 years ago (diff)
Remove declarations which were confusing the RHEL 4 chkconfig.
  • Property svn:executable set to *
Line 
1#!/bin/bash
2# $Id: ifplugd.init.in,v 1.3 2005-09-09 17:52:09 ghudson Exp $
3
4# This file is part of ifplugd.
5#
6# ifplugd is free software; you can redistribute it and/or modify it under
7# the terms of the GNU General Public License as published by the Free
8# Software Foundation; either version 2 of the License, or (at your
9# option) any later version.
10#
11# ifplugd is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14# for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with ifplugd; if not, write to the Free Software Foundation,
18# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19
20# ifplugd      Brings up/down network automatically
21#
22# chkconfig: 2345 11 89
23# description: Brings networks interfaces up and down automatically when \
24#              the cable is removed / inserted
25#
26# processname: @sbindir@/ifplugd
27# config: @sysconfdir@/ifplugd/ifplugd.conf
28
29#
30# Source the Athena configuration.
31#
32if [ -f /etc/athena/rc.conf ]; then
33  . /etc/athena/rc.conf
34  [ true = "$DISCONNECTABLE" ] || exit 0
35fi
36
37CFG=@sysconfdir@/ifplugd/ifplugd.conf
38
39IFPLUGD=@sbindir@/ifplugd
40test -x $IFPLUGD || exit 0
41
42if [ `id -u` != "0" ] && [ "$1" = "start" -o "$1" = "stop" ] ; then
43  echo "You must be root to start, stop or restart ifplugd."
44  exit 1
45fi
46
47[ -f $CFG ] && . $CFG
48
49VERB="$1"
50shift
51
52[ "x$*" != "x" ] && INTERFACES="$*"
53
54[ "x$INTERFACES" = "xauto" ] && INTERFACES="`cat /proc/net/dev | awk '{ print $1 }' | egrep '^(eth|wlan)' | cut -d: -f1`"
55
56case "$VERB" in
57    start)
58        echo -n "Starting Network Interface Plugging Daemon:"
59        for IF in $INTERFACES ; do
60            A="`eval echo \$\{ARGS_${IF}\}`"
61            [ -z "$A" ] && A="$ARGS"
62            $IFPLUGD -i $IF $A
63            echo -n " $IF"
64        done
65        echo "."
66        ;;
67    stop)
68        echo -n "Stopping Network Interface Plugging Daemon:"
69        for IF in $INTERFACES ; do
70            $IFPLUGD -k -i $IF
71            echo -n " $IF"
72        done
73        echo "."
74        ;;
75    status)
76        for IF in $INTERFACES ; do
77            $IFPLUGD -c -i $IF
78        done
79        ;;
80    suspend)
81        echo -n "Suspending Network Interface Plugging Daemon:"
82        for IF in $INTERFACES ; do
83            $IFPLUGD -S -i $IF
84            echo -n " $IF"
85        done
86        echo "."   
87        ;;
88    resume)
89        echo -n "Resuming Network Interface Plugging Daemon:"
90        for IF in $INTERFACES ; do
91            $IFPLUGD -R -i $IF
92            echo -n " $IF"
93        done
94        echo "."   
95        ;;
96    force-reload|restart)
97        $0 stop $INTERFACES
98        sleep 3
99        $0 start $INTERFACES
100        ;;
101    *)
102        echo "Usage: $0 {start|stop|restart|force-reload|status|suspend|resume}"
103        exit 1
104esac
105
106exit 0
Note: See TracBrowser for help on using the repository browser.