]>
Commit | Line | Data |
---|---|---|
95d225e3 ER |
1 | #!/bin/sh |
2 | # | |
772551e9 | 3 | # wicd Wicd Wireless Connection Daemon |
95d225e3 ER |
4 | # |
5 | # chkconfig: 345 99 01 | |
6 | # | |
772551e9 | 7 | # description: Wicd Wireless Connection Daemon |
95d225e3 ER |
8 | # |
9 | # processname: wicd | |
95d225e3 ER |
10 | # pidfile: /var/run/wicd.pid |
11 | # | |
12 | # $Id$ | |
13 | ||
14 | # Source function library | |
15 | . /etc/rc.d/init.d/functions | |
16 | ||
772551e9 ER |
17 | # Get network config |
18 | . /etc/sysconfig/network | |
95d225e3 ER |
19 | |
20 | # Get service config - may override defaults | |
772551e9 | 21 | [ -f /etc/sysconfig/wicd ] && . /etc/sysconfig/wicd |
95d225e3 | 22 | |
772551e9 ER |
23 | # Check that networking is up. |
24 | if is_yes "${NETWORKING}"; then | |
25 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
26 | msg_network_down "Wicd Connection Daemon" | |
27 | exit 1 | |
28 | fi | |
29 | else | |
30 | exit 0 | |
31 | fi | |
95d225e3 ER |
32 | |
33 | start() { | |
34 | # Check if the service is already running? | |
772551e9 ER |
35 | if [ -f /var/lock/subsys/wicd ]; then |
36 | msg_already_running "Wicd Connection Daemon" | |
37 | return | |
95d225e3 | 38 | fi |
772551e9 ER |
39 | |
40 | msg_starting "Wicd Connection Daemon" | |
41 | daemon /usr/sbin/wicd | |
42 | RETVAL=$? | |
43 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/wicd | |
95d225e3 ER |
44 | } |
45 | ||
46 | stop() { | |
772551e9 ER |
47 | if [ ! -f /var/lock/subsys/wicd ]; then |
48 | msg_not_running "Wicd Connection Daemon" | |
49 | return | |
95d225e3 | 50 | fi |
95d225e3 | 51 | |
772551e9 ER |
52 | # Stop daemons. |
53 | msg_stopping "Wicd Connection Daemon" | |
54 | killproc --pidfile /var/run/wicd.pid wicd -TERM | |
55 | rm -f /var/lock/subsys/wicd | |
56 | } | |
95d225e3 ER |
57 | |
58 | condrestart() { | |
772551e9 ER |
59 | if [ ! -f /var/lock/subsys/wicd ]; then |
60 | msg_not_running "Wicd Connection Daemon" | |
95d225e3 | 61 | RETVAL=$1 |
772551e9 | 62 | return |
95d225e3 | 63 | fi |
772551e9 ER |
64 | |
65 | stop | |
66 | start | |
95d225e3 ER |
67 | } |
68 | ||
69 | RETVAL=0 | |
70 | # See how we were called. | |
71 | case "$1" in | |
72 | start) | |
73 | start | |
74 | ;; | |
75 | stop) | |
76 | stop | |
77 | ;; | |
78 | restart) | |
79 | stop | |
80 | start | |
81 | ;; | |
82 | try-restart) | |
83 | condrestart 0 | |
84 | ;; | |
95d225e3 ER |
85 | force-reload) |
86 | condrestart 7 | |
87 | ;; | |
88 | status) | |
772551e9 | 89 | status --pidfile /var/run/wicd.pid wicd |
95d225e3 ER |
90 | RETVAL=$? |
91 | ;; | |
92 | *) | |
93 | msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" | |
94 | exit 3 | |
95 | esac | |
96 | ||
97 | exit $RETVAL |