crowbar/crowbar-ha

View on GitHub
chef/cookbooks/corosync/templates/default/corosync-wrapper.init.erb

Summary

Maintainability
Test Coverage
#! /bin/sh
#
# /etc/init.d/<%= @service_name %>-wrapper
#
### BEGIN INIT INFO
# Provides:          <%= @service_name %>-wrapper
# Required-Start:    $local_fs
# Should-Start:      $null
# Required-Stop:     $null
# Should-Stop:       $syslog sshd drbd $named $remote_fs logd xendomains xend iscsi libvirtd portmap rpcbind
# X-Stop-After:      <%= @service_name %>
# Default-Start:     3 5
# Default-Stop:      0 6
# Description:       Wrapper for <%= @service_name %> to avoid fencing loops
### END INIT INFO

. /etc/rc.status

rc_reset

case "$1" in
  start)
        if test -e <%= @block_corosync_file %>; then
          rc_failed 1
          rc_status -v
        else
          service <%= @service_name %> start
          rc_status -v
        fi
        ;;
  stop)
        service <%= @service_name %> stop && rm -f <%= @block_corosync_file %>
        rc_status -v
        ;;
  status)
        rc_status -v
        ;;
  reload)
        rc_status -v
        ;;
  *)
        echo "Usage: $0 {start|stop|status|reload}"
        exit 1
        ;;
esac

rc_exit