1 |
#! /bin/bash |
2 |
# |
3 |
# bandwidthd |
4 |
# |
5 |
# chkconfig: - 90 26 |
6 |
# description: Activates/Deactivates bandwidthd network traffic monitor |
7 |
PROGNAME=/usr/sbin/bandwidthd |
8 |
|
9 |
# Source function library. |
10 |
. /etc/init.d/functions |
11 |
|
12 |
if [ ! -f /etc/sysconfig/network ]; then |
13 |
exit 0 |
14 |
fi |
15 |
|
16 |
. /etc/sysconfig/network |
17 |
|
18 |
if [ -f /etc/sysconfig/bandwidthd ]; then |
19 |
. /etc/sysconfig/bandwidthd |
20 |
fi |
21 |
|
22 |
|
23 |
|
24 |
# Check that networking is up. |
25 |
[ "${NETWORKING}" = "no" ] && exit 0 |
26 |
|
27 |
|
28 |
|
29 |
# See how we were called. |
30 |
case "$1" in |
31 |
start) |
32 |
|
33 |
#Register to dns |
34 |
echo -n $"Starting Bandwidthd network traffic monitor: " |
35 |
daemon $PROGNAME $OPTIONS |
36 |
RETVAL=$? |
37 |
echo |
38 |
|
39 |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/bandwidthd |
40 |
exit $RETVAL |
41 |
;; |
42 |
|
43 |
stop) |
44 |
echo -n $"Shuting down Bandwidthd network traffic monitor: " |
45 |
killproc `basename $PROGNAME` |
46 |
RETVAL=$? |
47 |
echo |
48 |
|
49 |
[ $RETVAL -eq 0 ] && success || failure |
50 |
echo |
51 |
|
52 |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bandwidthd |
53 |
exit $RETVAL |
54 |
;; |
55 |
|
56 |
status) |
57 |
status $PROGNAME |
58 |
;; |
59 |
|
60 |
condrestart) |
61 |
if [ -f /var/lock/subsys/bandwidthd ]; then |
62 |
$0 stop |
63 |
$0 start |
64 |
fi |
65 |
;; |
66 |
|
67 |
restart|reload) |
68 |
$0 stop |
69 |
$0 start |
70 |
;; |
71 |
*) |
72 |
echo $"Usage: $0 {start|stop|restart|reload|status}" |
73 |
exit 1 |
74 |
esac |
75 |
|
76 |
exit 0 |