diff --git a/mxservicectl b/mxservicectl index 5541f25..49dacd9 100755 --- a/mxservicectl +++ b/mxservicectl @@ -19,7 +19,14 @@ function mxsrv_start_one() { . ${cfg} - su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} start" & + case "${MX_SRV_SCRIPT}" in + *.service) + systemctl start "${MX_SRV_SCRIPT}" + ;; + *) + su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} start" & + ;; + esac mv ${cfg}{,.r} @@ -34,7 +41,14 @@ function mxsrv_stop_one() { . ${cfg} - su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} stop" & + case "${MX_SRV_SCRIPT}" in + *.service) + systemctl stop "${MX_SRV_SCRIPT}" + ;; + *) + su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} stop" & + ;; + esac rm ${cfg}