ctdb-scripts: Support systemctl directly
authorMartin Schwenke <martin@meltin.net>
Tue, 10 May 2016 16:42:40 +0000 (02:42 +1000)
committerMartin Schwenke <martins@samba.org>
Fri, 20 May 2016 15:33:18 +0000 (17:33 +0200)
Some Linux distributions don't have a "service" compatibility command.

To avoid breaking working systems, prefer the "service" compatibility
command just in case it does some extra, unexpected magic.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Kai Blin <kai@samba.org>
ctdb/config/functions

index 8a8ee8c89f6be53de8b56e4c0a2214690a61c1f2..c1316bd3c74e8c567fa3d6e053afdaa336e9c3c6 100755 (executable)
@@ -212,6 +212,8 @@ _service ()
       $_nice /sbin/service "$_service_name" "$_op"
   elif [ -x /usr/sbin/service ]; then
       $_nice /usr/sbin/service "$_service_name" "$_op"
+  elif [ -x /bin/systemctl ]; then
+      $_nice /bin/systemctl "$_op" "$_service_name"
   elif [ -x $CTDB_SYS_ETCDIR/init.d/$_service_name ]; then
       $_nice $CTDB_SYS_ETCDIR/init.d/$_service_name "$_op"
   elif [ -x $CTDB_SYS_ETCDIR/rc.d/init.d/$_service_name ]; then