1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/ctdb/config/events
Andrew Tridgell cc9f6d30d8 split out the basic interface handling, and run event scripts in a deterministic order
(This used to be ctdb commit 399e993a4a233a5953e1e7264141e5c7c8c8c711)
2007-06-04 15:09:03 +10:00

41 lines
937 B
Bash
Executable File

#!/bin/sh
############################
# main event script for ctdb
#
# This script is called with one of the following sets of arguments
# startup : called when ctdb starts
# shutdown : called when ctdb shuts down
# takeip
. /etc/ctdb/functions
loadconfig ctdb
# ensure we have /bin and /usr/bin in the path
PATH=/bin:/usr/bin:$PATH
cmd="$1"
shift
case $cmd in
startup)
# make sure we have a blank state directory for the scripts to work with
/bin/rm -rf /etc/ctdb/state
/bin/mkdir -p /etc/ctdb/state
;;
esac
#######################################
# call all application or local scripts
[ -d /etc/ctdb/events.d ] && {
# only accept scripts of the form NN.name
/bin/ls /etc/ctdb/events.d | /bin/grep '^[0-9]*\.\w*$' | sort -n |
while read SCRIPT; do
[ -x /etc/ctdb/events.d/$SCRIPT ] && {
/etc/ctdb/events.d/$SCRIPT $cmd "$1" "$2" "$3" || exit 1
}
done
}
# all OK
exit 0