Commit dc7cf184 authored by Vitaly Lipatov's avatar Vitaly Lipatov

serv: allow additional params for start, stop and try_restart

parent d4061a1c
......@@ -20,15 +20,18 @@
# Start service
serv_start()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $1 start
sudocmd service $SERVICE start "$@"
;;
service-initd|service-update)
sudocmd /etc/init.d/$1 start
sudocmd /etc/init.d/$SERVICE start "$@"
;;
systemd)
sudocmd systemctl start $1
sudocmd systemctl start "$SERVICE" "$@"
;;
*)
fatal "Do not known command for $SERVICETYPE"
......
......@@ -20,15 +20,18 @@
# Stop service
serv_stop()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $1 stop
sudocmd service $SERVICE stop "$@"
;;
service-initd|service-update)
sudocmd /etc/init.d/$1 stop
sudocmd /etc/init.d/$SERVICE stop "$@"
;;
systemd)
sudocmd systemctl stop $1
sudocmd systemctl stop $SERVICE "$@"
;;
*)
fatal "Do not known command for $SERVICETYPE"
......
......@@ -22,17 +22,20 @@ load_helper serv-status
# Try restart service (if it is running)
serv_try_restart()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
is_service_running $1 || return 0
sudocmd service $1 restart
is_service_running $SERVICE || return 0
sudocmd service $SERVICE restart "$@"
;;
service-initd|service-update)
is_service_running $1 || return 0
sudocmd /etc/init.d/$1 restart
is_service_running $SERVICE || return 0
sudocmd /etc/init.d/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl try-restart $1
sudocmd systemctl try-restart $SERVICE "$@"
;;
*)
fatal "Do not known command for $SERVICETYPE"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment