ctdb-scripts: Change directory for notifications to events/notification
authorMartin Schwenke <martin@meltin.net>
Wed, 16 May 2018 02:18:46 +0000 (12:18 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 5 Jun 2018 15:47:26 +0000 (17:47 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/notification.README [moved from ctdb/config/notify.d.README with 78% similarity]
ctdb/config/notify.sh
ctdb/doc/ctdb.7.xml
ctdb/packaging/RPM/ctdb.spec.in
ctdb/wscript

similarity index 78%
rename from ctdb/config/notify.d.README
rename to ctdb/config/notification.README
index de56417159f0b6493ef860144179a9f766df64bb..16b632f653aff77b1d784396e007dd1c64820848 100755 (executable)
@@ -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 >/dev/null 2>&1
           ;;
   esac
-
-When adding programs please note the exclusion patterns in notify.sh.
index 9f947c771fc5657dd237677c4ceabf32829d6602..db69afc77c172cb6fe0759532d9c54fd0e78534d 100755 (executable)
@@ -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
 
index a4444c5539491048f6c0a960beb3f070da3ab7b4..09fb4ed7d8fa9b21742f5d57b8153c62dae6c444 100644 (file)
@@ -970,9 +970,10 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1
     </para>
 
     <para>
-      The notification mechanism runs all executable files in
-      <filename>/usr/local/etc/ctdb/notify.d/</filename>, ignoring any
-      failures and continuing to run all files.
+      The notification mechanism runs all executable files ending in
+      ".script" in
+      <filename>/usr/local/etc/ctdb/events/notification/</filename>,
+      ignoring any failures and continuing to run all files.
     </para>
 
     <para>
index 40871d3d8f269a53eab0a3a8703a5b929b2752b9..b07401fc1b94e8af4e240ab01515736711d90f66 100644 (file)
@@ -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
index 59c69aea4e6640f6f6704241c7ec703e5074cefa..ec8998e7ecab286332f32dbd86c1a34fffbe5206 100644 (file)
@@ -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)