Skip to content

Instantly share code, notes, and snippets.

@rust
Created February 27, 2009 06:40
Show Gist options
  • Save rust/71325 to your computer and use it in GitHub Desktop.
Save rust/71325 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# chkconfig: 345 70 8
# description: start up and shutdown drbd cluster.
#
# Copright 2009
# Shin-ichiro OGAWA, eole(c)
#
### BEGIN INIT INFO
# Required-Start: $network $syslog sshd
# Required-Stop: $network $syslog sshd
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Control drbd cluster.
### END INIT INFO
start() {
echo -n "Starting Cluster."
/etc/init.d/drbd start
/etc/init.d/cman start
/etc/init.d/clvmd start
/sbin/drbdadm primary r0
/bin/mount /opt
touch /var/lock/subsys/cluster
}
stop() {
echo -n "Stopping Cluster."
/bin/umount /opt
/sbin/drbdadm secondary r0
/etc/init.d/clvmd stop
/etc/init.d/cman stop
/etc/init.d/drbd stop
rm -f /var/lock/subsys/cluster
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
echo -n "Restarting Cluster."
stop
start
;;
*)
echo "Usage: /etc/init.d/drbd {start|stop|restart}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment