git.samba.org
/
sahlberg
/
ctdb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9690de9
)
cope with non-standard install dirs in event scripts
author
Andrew Tridgell
<tridge@samba.org>
Fri, 14 Sep 2007 04:14:03 +0000
(14:14 +1000)
committer
Andrew Tridgell
<tridge@samba.org>
Fri, 14 Sep 2007 04:14:03 +0000
(14:14 +1000)
config/ctdb.init
patch
|
blob
|
history
config/events.d/00.ctdb
patch
|
blob
|
history
config/events.d/10.interface
patch
|
blob
|
history
config/events.d/40.vsftpd
patch
|
blob
|
history
config/events.d/50.samba
patch
|
blob
|
history
config/events.d/60.nfs
patch
|
blob
|
history
config/events.d/61.nfstickle
patch
|
blob
|
history
config/functions
patch
|
blob
|
history
config/statd-callout
patch
|
blob
|
history
server/ctdbd.c
patch
|
blob
|
history
diff --git
a/config/ctdb.init
b/config/ctdb.init
index 91b1094ebe17cd44446c72e9bd0c544bf0056009..dbc1bef1c230fc0dd6454834068370bbfdd6f8f5 100755
(executable)
--- a/
config/ctdb.init
+++ b/
config/ctdb.init
@@
-34,7
+34,11
@@
fi
# Avoid using root's TMPDIR
unset TMPDIR
# Avoid using root's TMPDIR
unset TMPDIR
-. /etc/ctdb/functions
+[ -z "$CTDB_BASE" ] && {
+ export CTDB_BASE="/etc/ctdb"
+}
+
+. $CTDB_BASE/functions
loadconfig network
loadconfig ctdb
loadconfig network
loadconfig ctdb
@@
-100,7
+104,7
@@
stop() {
[ $count -gt 10 ] && {
echo -n $"killing ctdbd "
killall -q -9 ctdbd
[ $count -gt 10 ] && {
echo -n $"killing ctdbd "
killall -q -9 ctdbd
- pkill -9 -f
/etc/ctdb
/events.d/
+ pkill -9 -f
$CTDB_BASE
/events.d/
}
done
case $init_style in
}
done
case $init_style in
diff --git
a/config/events.d/00.ctdb
b/config/events.d/00.ctdb
index c12d58c542476e5bf48631457372ebcdd1ab10c5..abcb651307f7b9f59a15137495891dbc5b792f55 100755
(executable)
--- a/
config/events.d/00.ctdb
+++ b/
config/events.d/00.ctdb
@@
-9,7
+9,7
@@
# releaseip : called when an IP address is released
# recovered : called when ctdb has finished a recovery event
# releaseip : called when an IP address is released
# recovered : called when ctdb has finished a recovery event
-.
/etc/ctdb
/functions
+.
$CTDB_BASE
/functions
loadconfig ctdb
# ensure we have /bin and /usr/bin in the path
loadconfig ctdb
# ensure we have /bin and /usr/bin in the path
@@
-21,8
+21,8
@@
shift
case $cmd in
startup)
# make sure we have a blank state directory for the scripts to work with
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
+ /bin/rm -rf
$CTDB_BASE
/state
+ /bin/mkdir -p
$CTDB_BASE
/state
# set any tunables from the config file
set | grep ^CTDB_SET_ | cut -d_ -f3- |
# set any tunables from the config file
set | grep ^CTDB_SET_ | cut -d_ -f3- |
diff --git
a/config/events.d/10.interface
b/config/events.d/10.interface
index 6e43fa03438ded1daa86cb9a406b0f8d0b6bf3a4..7d95a198373d9022bcc600b3fb57460c80307dd0 100755
(executable)
--- a/
config/events.d/10.interface
+++ b/
config/events.d/10.interface
@@
-5,14
+5,14
@@
# this adds/removes IPs from your
# public interface
# this adds/removes IPs from your
# public interface
-.
/etc/ctdb
/functions
+.
$CTDB_BASE
/functions
loadconfig ctdb
cmd="$1"
shift
[ -z "$CTDB_PUBLIC_ADDRESSES" ] && {
loadconfig ctdb
cmd="$1"
shift
[ -z "$CTDB_PUBLIC_ADDRESSES" ] && {
- CTDB_PUBLIC_ADDRESSES=
/etc/ctdb
/public_addresses
+ CTDB_PUBLIC_ADDRESSES=
$CTDB_BASE
/public_addresses
}
[ ! -f "$CTDB_PUBLIC_ADDRESSES" ] && {
}
[ ! -f "$CTDB_PUBLIC_ADDRESSES" ] && {
@@
-27,7
+27,7
@@
kill_tcp_connections() {
_failed=0
_killcount=0
_failed=0
_killcount=0
- connfile="
/etc/ctdb
/state/connections.$_IP"
+ connfile="
$CTDB_BASE
/state/connections.$_IP"
netstat -tn |egrep "^tcp.*\s+$_IP:.*ESTABLISHED" | awk '{print $4" "$5}' > $connfile
while read dest src; do
srcip=`echo $src | cut -d: -f1`
netstat -tn |egrep "^tcp.*\s+$_IP:.*ESTABLISHED" | awk '{print $4" "$5}' > $connfile
while read dest src; do
srcip=`echo $src | cut -d: -f1`
diff --git
a/config/events.d/40.vsftpd
b/config/events.d/40.vsftpd
index 6f48e37b32a4a030d8c46abd263aecc295f420ed..525b69bf79d562e4a7a594a8d4f98c104fcb606a 100755
(executable)
--- a/
config/events.d/40.vsftpd
+++ b/
config/events.d/40.vsftpd
@@
-1,7
+1,7
@@
#!/bin/sh
# event strict to manage vsftpd in a cluster environment
#!/bin/sh
# event strict to manage vsftpd in a cluster environment
-.
/etc/ctdb
/functions
+.
$CTDB_BASE
/functions
loadconfig vsftpd
[ "$CTDB_MANAGES_VSFTPD" = "yes" ] || exit 0
loadconfig vsftpd
[ "$CTDB_MANAGES_VSFTPD" = "yes" ] || exit 0
@@
-11,7
+11,7
@@
shift
case $cmd in
startup)
case $cmd in
startup)
- /bin/mkdir -p
/etc/ctdb
/state/vsftpd
+ /bin/mkdir -p
$CTDB_BASE
/state/vsftpd
# make sure the service is stopped first
service vsftpd stop > /dev/null 2>&1
# make sure the service is stopped first
service vsftpd stop > /dev/null 2>&1
@@
-23,22
+23,22
@@
case $cmd in
;;
takeip)
;;
takeip)
- echo "restart" >>
/etc/ctdb
/state/vsftpd/restart
+ echo "restart" >>
$CTDB_BASE
/state/vsftpd/restart
;;
releaseip)
;;
releaseip)
- echo "restart" >>
/etc/ctdb
/state/vsftpd/restart
+ echo "restart" >>
$CTDB_BASE
/state/vsftpd/restart
;;
recovered)
# if we have taken or released any ips we must
# restart vsftpd to ensure that all tcp connections are reset
;;
recovered)
# if we have taken or released any ips we must
# restart vsftpd to ensure that all tcp connections are reset
- [ -f
/etc/ctdb
/state/vsftpd/restart ] && {
+ [ -f
$CTDB_BASE
/state/vsftpd/restart ] && {
service vsftpd stop > /dev/null 2>&1
service vsftpd start
} >/dev/null 2>&1
service vsftpd stop > /dev/null 2>&1
service vsftpd start
} >/dev/null 2>&1
- /bin/rm -f
/etc/ctdb
/state/vsftpd/restart
+ /bin/rm -f
$CTDB_BASE
/state/vsftpd/restart
;;
esac
;;
esac
diff --git
a/config/events.d/50.samba
b/config/events.d/50.samba
index 04aeaa3c74539ff9e6dd34c165b32e997326a2f9..54c2645b9afb97357f46f7d202606307218e4e72 100755
(executable)
--- a/
config/events.d/50.samba
+++ b/
config/events.d/50.samba
@@
-3,7
+3,7
@@
PATH=/bin:/usr/bin:$PATH
PATH=/bin:/usr/bin:$PATH
-.
/etc/ctdb
/functions
+.
$CTDB_BASE
/functions
loadconfig ctdb
cmd="$1"
loadconfig ctdb
cmd="$1"
@@
-28,7
+28,7
@@
periodic_cleanup() {
case $cmd in
startup)
# create the state directory for samba
case $cmd in
startup)
# create the state directory for samba
- /bin/mkdir -p
/etc/ctdb
/state/samba
+ /bin/mkdir -p
$CTDB_BASE
/state/samba
# wait for all shared directories to become available
smb_dirs=`testparm -s 2> /dev/null | egrep '^\s*path = ' | cut -d= -f2`
# wait for all shared directories to become available
smb_dirs=`testparm -s 2> /dev/null | egrep '^\s*path = ' | cut -d= -f2`
@@
-79,13
+79,13
@@
case $cmd in
monitor)
# Create a dummy file to track when we need to do periodic cleanup
# of samba databases
monitor)
# Create a dummy file to track when we need to do periodic cleanup
# of samba databases
- [ -f
/etc/ctdb
/state/samba/periodic_cleanup ] || {
- touch
/etc/ctdb
/state/samba/periodic_cleanup
+ [ -f
$CTDB_BASE
/state/samba/periodic_cleanup ] || {
+ touch
$CTDB_BASE
/state/samba/periodic_cleanup
}
}
- [ `/usr/bin/find
/etc/ctdb
/state/samba/periodic_cleanup -mmin +$SAMBA_CLEANUP_PERIOD | wc -l` -eq 1 ] && {
+ [ `/usr/bin/find
$CTDB_BASE
/state/samba/periodic_cleanup -mmin +$SAMBA_CLEANUP_PERIOD | wc -l` -eq 1 ] && {
# Cleanup the databases
periodic_cleanup
# Cleanup the databases
periodic_cleanup
- touch
/etc/ctdb
/state/samba/periodic_cleanup
+ touch
$CTDB_BASE
/state/samba/periodic_cleanup
}
testparm -s 2>&1 | egrep '^WARNING|^ERROR|^Unknown' && {
}
testparm -s 2>&1 | egrep '^WARNING|^ERROR|^Unknown' && {
diff --git
a/config/events.d/60.nfs
b/config/events.d/60.nfs
index f19dfea14945aab751535bdb951335b7f4ba87c9..7d1a3801662b822620bb6a610dd1c89654a5c4f5 100755
(executable)
--- a/
config/events.d/60.nfs
+++ b/
config/events.d/60.nfs
@@
-1,7
+1,7
@@
#!/bin/sh
# script to manage nfs in a clustered environment
#!/bin/sh
# script to manage nfs in a clustered environment
-.
/etc/ctdb
/functions
+.
$CTDB_BASE
/functions
loadconfig nfs
[ "$CTDB_MANAGES_NFS" = "yes" ] || exit 0
loadconfig nfs
[ "$CTDB_MANAGES_NFS" = "yes" ] || exit 0
@@
-14,8
+14,8
@@
PATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH
case $cmd in
startup)
case $cmd in
startup)
- /bin/mkdir -p
/etc/ctdb
/state/nfs
- /bin/mkdir -p
/etc/ctdb
/state/statd/ip
+ /bin/mkdir -p
$CTDB_BASE
/state/nfs
+ /bin/mkdir -p
$CTDB_BASE
/state/statd/ip
/bin/mkdir -p $STATD_SHARED_DIRECTORY
ctdb_wait_directories "nfslock" "$STATD_SHARED_DIRECTORY"
/bin/mkdir -p $STATD_SHARED_DIRECTORY
ctdb_wait_directories "nfslock" "$STATD_SHARED_DIRECTORY"
@@
-41,11
+41,11
@@
case $cmd in
takeip)
ip=$2
takeip)
ip=$2
- echo $ip >>
/etc/ctdb
/state/statd/restart
+ echo $ip >>
$CTDB_BASE
/state/statd/restart
# having a list of what IPs we have allows statd to do the right
# having a list of what IPs we have allows statd to do the right
- # thing via
/etc/ctdb
/statd-callout
- /bin/touch
/etc/ctdb
/state/statd/ip/$ip
+ # thing via
$CTDB_BASE
/statd-callout
+ /bin/touch
$CTDB_BASE
/state/statd/ip/$ip
exit 0
;;
exit 0
;;
@@
-54,19
+54,19
@@
case $cmd in
ip=$2
maskbits=$3
ip=$2
maskbits=$3
- echo $ip >>
/etc/ctdb
/state/statd/restart
- /bin/rm -f
/etc/ctdb
/state/statd/ip/$ip
+ echo $ip >>
$CTDB_BASE
/state/statd/restart
+ /bin/rm -f
$CTDB_BASE
/state/statd/ip/$ip
exit 0
;;
recovered)
# always restart the lockmanager so that we start with a clusterwide
# graceperiod when ip addresses has changed
exit 0
;;
recovered)
# always restart the lockmanager so that we start with a clusterwide
# graceperiod when ip addresses has changed
- [ -x
/etc/ctdb
/statd-callout ] && {
-
/etc/ctdb
/statd-callout notify &
+ [ -x
$CTDB_BASE
/statd-callout ] && {
+
$CTDB_BASE
/statd-callout notify &
} >/dev/null 2>&1
} >/dev/null 2>&1
- /bin/rm -f
/etc/ctdb
/state/statd/restart
+ /bin/rm -f
$CTDB_BASE
/state/statd/restart
;;
monitor)
;;
monitor)
diff --git
a/config/events.d/61.nfstickle
b/config/events.d/61.nfstickle
index d8901437492be9700885b41973c80b405fc52bbf..d71dfbeed5e7ac34ebfc6eab4d7d45c44bcbd1aa 100755
(executable)
--- a/
config/events.d/61.nfstickle
+++ b/
config/events.d/61.nfstickle
@@
-3,7
+3,7
@@
PATH=/bin:/usr/bin:$PATH
PATH=/bin:/usr/bin:$PATH
-.
/etc/ctdb
/functions
+.
$CTDB_BASE
/functions
loadconfig nfs
cmd="$1"
loadconfig nfs
cmd="$1"
@@
-14,7
+14,7
@@
shift
case $cmd in
startup)
case $cmd in
startup)
- mkdir -p
/etc/ctdb
/state/nfstickle
+ mkdir -p
$CTDB_BASE
/state/nfstickle
mkdir -p $NFS_TICKLE_SHARED_DIRECTORY/`hostname`
# we rely on fast tcp wait1 recycling
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
mkdir -p $NFS_TICKLE_SHARED_DIRECTORY/`hostname`
# we rely on fast tcp wait1 recycling
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
diff --git
a/config/functions
b/config/functions
index f7ffd01079f58f26b69a9eb9625d7adb195b8428..3c39addc02a56f9ad53b3db88068567b068752ca 100644
(file)
--- a/
config/functions
+++ b/
config/functions
@@
-8,8
+8,8
@@
loadconfig() {
. /etc/sysconfig/$name
elif [ -f /etc/default/$name ]; then
. /etc/default/$name
. /etc/sysconfig/$name
elif [ -f /etc/default/$name ]; then
. /etc/default/$name
- elif [ -f
/etc/ctdb
/sysconfig/$name ]; then
- .
/etc/ctdb
/sysconfig/$name
+ elif [ -f
$CTDB_BASE
/sysconfig/$name ]; then
+ .
$CTDB_BASE
/sysconfig/$name
fi
}
fi
}
diff --git
a/config/statd-callout
b/config/statd-callout
index f7389fc3b5c6318acf88e3b1346b7a8ddf03aa4c..f582a1a8e028358b3c88cef833d43dad5db48770 100755
(executable)
--- a/
config/statd-callout
+++ b/
config/statd-callout
@@
-5,7
+5,11
@@
# /etc/sysconfig/nfs:
# STATD_HOSTNAME="myhostname -H /etc/ctdb/statd-callout"
# /etc/sysconfig/nfs:
# STATD_HOSTNAME="myhostname -H /etc/ctdb/statd-callout"
-. /etc/ctdb/functions
+[ -z "$CTDB_BASE" ] && {
+ export CTDB_BASE="/etc/ctdb"
+}
+
+. $CTDB_BASE/functions
loadconfig nfs
[ -z "$STATD_SHARED_DIRECTORY" ] && {
loadconfig nfs
[ -z "$STATD_SHARED_DIRECTORY" ] && {
@@
-24,7
+28,7
@@
case "$1" in
add-client)
# the callout does not tell us to which ip the client connected
# so we must add it to all the ips that we serve
add-client)
# the callout does not tell us to which ip the client connected
# so we must add it to all the ips that we serve
- for f in `/bin/ls
/etc/ctdb
/state/statd/ip/*`; do
+ for f in `/bin/ls
$CTDB_BASE
/state/statd/ip/*`; do
ip=`/bin/basename $f`
[ -d $STATD_SHARED_DIRECTORY/$ip ] || /bin/mkdir $STATD_SHARED_DIRECTORY/$ip
/bin/touch $STATD_SHARED_DIRECTORY/$ip/$2
ip=`/bin/basename $f`
[ -d $STATD_SHARED_DIRECTORY/$ip ] || /bin/mkdir $STATD_SHARED_DIRECTORY/$ip
/bin/touch $STATD_SHARED_DIRECTORY/$ip/$2
@@
-33,7
+37,7
@@
case "$1" in
del-client)
# the callout does not tell us to which ip the client connected
# so we must add it to all the ips that we serve
del-client)
# the callout does not tell us to which ip the client connected
# so we must add it to all the ips that we serve
- for f in `/bin/ls
/etc/ctdb
/state/statd/ip/*`; do
+ for f in `/bin/ls
$CTDB_BASE
/state/statd/ip/*`; do
ip=`/bin/basename $f`
/bin/rm -f $STATD_SHARED_DIRECTORY/$ip/$2
done
ip=`/bin/basename $f`
/bin/rm -f $STATD_SHARED_DIRECTORY/$ip/$2
done
@@
-81,7
+85,7
@@
case "$1" in
sleep 2
# copy all monitored clients on this node to the local lockmanager
sleep 2
# copy all monitored clients on this node to the local lockmanager
- for f in `/bin/ls
/etc/ctdb
/state/statd/ip/* 2>/dev/null`; do
+ for f in `/bin/ls
$CTDB_BASE
/state/statd/ip/* 2>/dev/null`; do
ip=`/bin/basename $f`
[ -d $STATD_SHARED_DIRECTORY/$ip ] && [ -x /usr/bin/smnotify ] && {
for g in `/bin/ls $STATD_SHARED_DIRECTORY/$ip/* 2>/dev/null`; do
ip=`/bin/basename $f`
[ -d $STATD_SHARED_DIRECTORY/$ip ] && [ -x /usr/bin/smnotify ] && {
for g in `/bin/ls $STATD_SHARED_DIRECTORY/$ip/* 2>/dev/null`; do
@@
-122,7
+126,7
@@
case "$1" in
# Both 2a and 2b are commonly used in lockmanagers since they maximize
# probability that the client will accept the statd notify packet and
# not just ignore it.
# Both 2a and 2b are commonly used in lockmanagers since they maximize
# probability that the client will accept the statd notify packet and
# not just ignore it.
- for f in `/bin/ls
/etc/ctdb
/state/statd/ip/* 2>/dev/null`; do
+ for f in `/bin/ls
$CTDB_BASE
/state/statd/ip/* 2>/dev/null`; do
ip=`/bin/basename $f`
[ -d $STATD_SHARED_DIRECTORY/$ip ] && [ -x /usr/bin/smnotify ] && {
for g in `/bin/ls $STATD_SHARED_DIRECTORY/$ip/* 2>/dev/null`; do
ip=`/bin/basename $f`
[ -d $STATD_SHARED_DIRECTORY/$ip ] && [ -x /usr/bin/smnotify ] && {
for g in `/bin/ls $STATD_SHARED_DIRECTORY/$ip/* 2>/dev/null`; do
diff --git
a/server/ctdbd.c
b/server/ctdbd.c
index 500773375eb3731373ff479735c2f244164b1100..92f4b86c53780068972af7d3204cc673b3bf940e 100644
(file)
--- a/
server/ctdbd.c
+++ b/
server/ctdbd.c
@@
-229,6
+229,10
@@
int main(int argc, const char *argv[])
ctdb->do_setsched = !options.no_setsched;
ctdb->do_setsched = !options.no_setsched;
+ /* setup a environment variable for the event scripts to use to find the
+ installation directory */
+ setenv("CTDB_BASE", ETCDIR "/ctdb", 1);
+
/* start the protocol running (as a child) */
return ctdb_start_daemon(ctdb, interactive?False:True);
}
/* start the protocol running (as a child) */
return ctdb_start_daemon(ctdb, interactive?False:True);
}