From: Martin Schwenke Date: Wed, 16 May 2018 02:18:46 +0000 (+1000) Subject: ctdb-scripts: Change directory for notifications to events/notification X-Git-Tag: tevent-0.9.37~424 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4bdf97a935d19454fbd544616640a22f2bafe55f;p=thirdparty%2Fsamba.git ctdb-scripts: Change directory for notifications to events/notification Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/notify.d.README b/ctdb/config/notification.README similarity index 78% rename from ctdb/config/notify.d.README rename to ctdb/config/notification.README index de56417159f..16b632f653a 100755 --- a/ctdb/config/notify.d.README +++ b/ctdb/config/notification.README @@ -1,6 +1,6 @@ -This directory should contain executable programs to handle CTDB event -notifications. The first and only argument passed to each program is -the event, which is one of: +This directory should contain executable programs ending in ".script" +to handle CTDB event notifications. The first and only argument +passed to each program is the event, which is one of: init, setup, startup, unhealthy, healthy @@ -34,5 +34,3 @@ Alternatively, email could be sent: mail -s "$(hostname) is HEALTHY" foo@example.com /dev/null 2>&1 ;; esac - -When adding programs please note the exclusion patterns in notify.sh. diff --git a/ctdb/config/notify.sh b/ctdb/config/notify.sh index 9f947c771fc..db69afc77c1 100755 --- a/ctdb/config/notify.sh +++ b/ctdb/config/notify.sh @@ -1,19 +1,14 @@ #!/bin/sh # This is script is invoked from ctdb when certain events happen. See -# /etc/ctdb/notify.d/README for more details. +# /etc/ctdb/events/notification/README for more details. d=$(dirname "$0") -nd="${d}/notify.d" +nd="${d}/events/notification" ok=true -for i in "${nd}/"* ; do - # Don't run files matching basename - case "${i##*/}" in - *~|*,|*.rpm*|*.swp|README) continue ;; - esac - +for i in "${nd}/"*.script ; do # Files must be executable [ -x "$i" ] || continue diff --git a/ctdb/doc/ctdb.7.xml b/ctdb/doc/ctdb.7.xml index a4444c55394..09fb4ed7d8f 100644 --- a/ctdb/doc/ctdb.7.xml +++ b/ctdb/doc/ctdb.7.xml @@ -970,9 +970,10 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1 - The notification mechanism runs all executable files in - /usr/local/etc/ctdb/notify.d/, ignoring any - failures and continuing to run all files. + The notification mechanism runs all executable files ending in + ".script" in + /usr/local/etc/ctdb/events/notification/, + ignoring any failures and continuing to run all files. diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in index 40871d3d8f2..b07401fc1b9 100644 --- a/ctdb/packaging/RPM/ctdb.spec.in +++ b/ctdb/packaging/RPM/ctdb.spec.in @@ -128,14 +128,14 @@ mkdir -p $RPM_BUILD_ROOT%{initdir} install -m755 config/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb %endif -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/notify.d +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events/notification # This is a hack. All documents should be installed in /usr/share/doc. rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events/README cp config/events/README README.eventscripts rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/nfs-checks.d/README cp config/nfs-checks.d/README README.nfs-checks.d -cp config/notify.d.README README.notify.d +cp config/notification.README README.notification # Remove "*.old" files find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \; @@ -155,7 +155,7 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %{_sysconfdir}/ctdb/ctdb.tunables %config(noreplace) %{_sysconfdir}/ctdb/script.options %{_sysconfdir}/ctdb/notify.sh -%dir %{_sysconfdir}/ctdb/notify.d +%dir %{_sysconfdir}/ctdb/events/notification %config(noreplace) %{_sysconfdir}/ctdb/debug-hung-script.sh %config(noreplace) %{_sysconfdir}/ctdb/ctdb-crash-cleanup.sh %config(noreplace) %{_sysconfdir}/ctdb/debug_locks.sh @@ -168,10 +168,8 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) %{initdir}/ctdb %endif -%attr(755,root,root) %{_sysconfdir}/ctdb/notify.d - %doc README COPYING -%doc README.eventscripts README.notify.d +%doc README.eventscripts README.notification %doc doc/recovery-process.txt %doc doc/cluster_mutex_helper.txt %doc doc/*.html diff --git a/ctdb/wscript b/ctdb/wscript index 59c69aea4e6..ec8998e7eca 100644 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -772,7 +772,8 @@ def build(bld): bld.INSTALL_FILES('${SYSCONFDIR}/sudoers.d', 'ctdb.sudoers', destname='ctdb') - bld.INSTALL_FILES('${CTDB_ETCDIR}/notify.d', 'config/notify.d.README', + bld.INSTALL_FILES('${CTDB_ETCDIR}/events/notification', + 'config/notification.README', destname='README') bld.install_dir(bld.env.CTDB_LOGDIR)