]> git.pld-linux.org Git - packages/ggaoed.git/blob - ggaoed.init
- works fine, release 1.
[packages/ggaoed.git] / ggaoed.init
1 #!/bin/sh
2 #
3 # ggaoed        This shell script takes care of starting and stopping ggaoed
4 #
5 # chkconfig:    2345 81 29
6 #
7 # description:  ggaoed is an AoE (ATA over Ethernet) target implementation for Linux. \
8 #               It utilizes Linux kernel AIO, memory mapped sockets and other Linux features \
9 #               to provide the best performance.
10 #
11 # pidfile:      /var/run/ggaoed.pid
12 # config:       /etc/ggaoed.conf
13
14
15 # Source function library
16 . /etc/rc.d/init.d/functions
17
18 # Get network config
19 . /etc/sysconfig/network
20
21 # Get service config
22 [ -f /etc/sysconfig/ggaoed ] && . /etc/sysconfig/ggaoed
23
24 # Check that networking is up.
25 if is_yes "${NETWORKING}"; then
26         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
27                 msg_network_down ggaoed
28                 exit 1
29         fi
30 else
31         exit 0
32 fi
33
34 start() {
35         # Check if the service is already running?
36         if [ ! -f /var/lock/subsys/ggaoed ]; then
37                 msg_starting ggaoed
38                 daemon /usr/sbin/ggaoed $GGAOED_OPTS
39                 RETVAL=$?
40                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ggaoed
41         else
42                 msg_already_running ggaoed
43         fi
44 }
45
46 stop() {
47         if [ -f /var/lock/subsys/ggaoed ]; then
48                 # Stop daemons.
49                 msg_stopping ggaoed
50                 killproc ggaoed
51                 rm -f /var/lock/subsys/ggaoed >/dev/null 2>&1
52         else
53                 msg_not_running ggaoed
54         fi
55 }
56
57 reload() {
58         if [ -f /var/lock/subsys/ggaoed ]; then
59                 msg_reloading ggaoed
60                 busy
61                 /usr/sbin/ggaoectl reload
62                 RETVAL=$?
63                 [ $RETVAL -ne 0 ] && RETVAL=7
64                 [ $RETVAL -eq 0 ] && ok || fail
65         else
66                 msg_not_running ggaoed
67                 exit 7
68         fi
69 }
70
71 restart() {
72         stop
73         start
74 }
75
76 condrestart() {
77         if [ -f /var/lock/subsys/ggaoed ]; then
78                 stop
79                 start
80         else
81                 msg_not_running ggaoed
82                 RETVAL=0
83         fi
84 }
85
86 RETVAL=0
87 # See how we were called.
88 case "$1" in
89   start)
90         start
91         ;;
92   stop)
93         stop
94         ;;
95   restart)
96         restart
97         ;;
98   try-restart)
99         condrestart
100         ;;
101   reload|force-reload)
102         reload
103         ;;
104   status)
105         status ggaoed
106         /usr/sbin/ggaoectl stats
107         exit $?
108         ;;
109   *)
110         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
111         exit 3
112 esac
113
114 exit $RETVAL
This page took 0.089339 seconds and 3 git commands to generate.