]>
Commit | Line | Data |
---|---|---|
c16d015f | 1 | #!/bin/sh |
2 | # | |
3 | # 3dm2: Starts the 3ware daemon | |
4 | # | |
5 | # Author: Rafal Cygnarowski <pascalek@pld-linux.org> | |
6 | # | |
7 | # chkconfig: 345 40 60 | |
8 | # description: Start the 3dm2 application which logs the current state | |
9 | # of the 3ware DiskSwitch controller card, and then polls | |
10 | # for state changes. | |
11 | # | |
12 | # processname: 3dm2 | |
13 | # config: /etc/3dm2/3dm2.conf | |
14 | ||
15 | # Source function library. | |
16 | . /etc/rc.d/init.d/functions | |
17 | ||
18 | RETVAL=0 | |
19 | ||
20 | # See how we were called. | |
21 | case "$1" in | |
22 | start) | |
23 | if [ ! -f /var/lock/subsys/3dm2 ]; then | |
24 | msg_starting "3DM2 Utility" | |
25 | start-stop-daemon --start --quiet --exec /usr/sbin/3dm2 | |
26 | RETVAL=$? | |
27 | if [ $RETVAL -eq 0 ]; then | |
28 | ok | |
29 | touch /var/lock/subsys/3dm2 | |
30 | else | |
31 | fail | |
32 | RETVAL=1 | |
33 | fi | |
34 | else | |
35 | msg_already_running "3DM2 Utility" | |
36 | fi | |
37 | ;; | |
38 | stop) | |
39 | if [ -f /var/lock/subsys/3dm2 ]; then | |
40 | msg_stopping "3DM2 Utility" | |
41 | start-stop-daemon --stop --quiet --exec /usr/sbin/3dm2 1> /dev/null | |
42 | RETVAL=$? | |
43 | if [ $RETVAL -eq 0 ]; then | |
44 | ok | |
45 | rm -f /var/lock/subsys/3dm2 | |
46 | else | |
47 | fail | |
48 | RETVAL=1 | |
49 | fi | |
50 | else | |
51 | msg_not_running "3DM2 Utility" | |
52 | fi | |
53 | ;; | |
54 | status) | |
55 | status 3dm2 | |
56 | RETVAL=$? | |
57 | ;; | |
58 | restart) | |
59 | $0 stop | |
60 | sleep 2 | |
61 | $0 start | |
62 | RETVAL=$? | |
63 | ;; | |
64 | *) | |
65 | echo "Usage: $0 {start|stop|status|restart}" | |
66 | exit 1 | |
67 | esac | |
68 | ||
69 | exit $RETVAL |