diff --git a/ctdb/config/events.d/50.samba b/ctdb/config/events.d/50.samba index ed1136fd8de..c67dbda684a 100755 --- a/ctdb/config/events.d/50.samba +++ b/ctdb/config/events.d/50.samba @@ -66,7 +66,7 @@ case $cmd in # start Samba service. Start it reniced, as under very heavy load # the number of smbd processes will mean that it leaves few cycles for # anything else - nice service smb start + nice_service smb start ;; takeip) diff --git a/ctdb/config/functions b/ctdb/config/functions index 2e79c3330a5..9b334225e50 100644 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -28,6 +28,19 @@ service() { fi } +###################################################### +# simulate /sbin/service (niced) on platforms that don't have it +nice_service() { + service_name="$1" + op="$2" + if [ -x /sbin/service ]; then + nice /sbin/service "$service_name" "$op" + elif [ -x /etc/init.d/$service_name ]; then + nice /etc/init.d/$service_name "$op" + elif [ -x /etc/rc.d/init.d/$service_name ]; then + nice /etc/rc.d/init.d/$service_name "$op" + fi +} ###################################################### # wait for a command to return a zero exit status