#!/bin/sh # # ggaoed This shell script takes care of starting and stopping ggaoed # # chkconfig: 2345 81 29 # # description: ggaoed is an AoE (ATA over Ethernet) target implementation for Linux. \ # It utilizes Linux kernel AIO, memory mapped sockets and other Linux features \ # to provide the best performance. # # pidfile: /var/run/ggaoed.pid # config: /etc/ggaoed.conf # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # Get service config [ -f /etc/sysconfig/ggaoed ] && . /etc/sysconfig/ggaoed # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then msg_network_down ggaoed exit 1 fi else exit 0 fi start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/ggaoed ]; then msg_starting ggaoed daemon /usr/sbin/ggaoed $GGAOED_OPTS RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ggaoed else msg_already_running ggaoed fi } stop() { if [ -f /var/lock/subsys/ggaoed ]; then # Stop daemons. msg_stopping ggaoed killproc ggaoed rm -f /var/lock/subsys/ggaoed >/dev/null 2>&1 else msg_not_running ggaoed fi } reload() { if [ -f /var/lock/subsys/ggaoed ]; then msg_reloading ggaoed busy /usr/sbin/ggaoectl reload RETVAL=$? [ $RETVAL -ne 0 ] && RETVAL=7 [ $RETVAL -eq 0 ] && ok || fail else msg_not_running ggaoed exit 7 fi } restart() { stop start } condrestart() { if [ -f /var/lock/subsys/ggaoed ]; then stop start else msg_not_running ggaoed RETVAL=0 fi } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; try-restart) condrestart ;; reload|force-reload) reload ;; status) status ggaoed /usr/sbin/ggaoectl stats exit $? ;; *) msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" exit 3 esac exit $RETVAL