All pastes #767418 Raw Edit

kevev

public text v1 · immutable
·published 2007-11-09 19:13 UTC
rendered paste body
#!/bin/bash
#
#	/etc/rc.d/init.d/
#
#
#
#
#

# Source function library.
. /etc/init.d/functions

PIDFILE=/var/run/glusterfs-client.pid

start() {
       echo -n "Mounting /etc/httpd..."
               /usr/local/sbin/glusterfs -f /usr/local/etc/glusterfs/glusterfs-client.vol -n readahead-etc-httpd /etc/httpd
               RETVAL=$?
               [ "$RETVAL" = 0 ] && touch /var/lock/subsys/etc-httpd
       echo
       echo -n "Mounting /var/www..."
               /usr/local/sbin/glusterfs -f /usr/local/etc/glusterfs/glusterfs-client.vol -n readahead-var-www /var/www
               RETVAL=$?
               [ "$RETVAL" = 0 ] && touch /var/lock/subsys/var-www
       echo
       echo -n "Healing /etc/httpd..."
               sleep 2 && find /etc/httpd -type f -exec head -c 1 {} \;
       echo
       echo -n "Healing /var/www..."
               sleep 2 && find /var/www -type f -exec head -c 1 {} \;
       echo
}

stop() {
       echo -n "Dis-Mounting /var/www..."
       umount /var/www
       RETVAL=$?
       [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/var-www
       echo
       echo -n "Dis-Mounting /etc/httpd..."
       umount /etc/httpd
       RETVAL=$?
       [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/etc-httpd
       echo
}

case "$1" in
       start)
               start
               ;;
       stop)
               stop
               ;;
       status)
               status glusterfs-client
               ;;
       restart)
               stop
               start
               ;;
       *)
               echo "Usage:  {start|stop|status|restart}"
               exit 1
               ;;
esac
exit $?