Commit cae4f10b authored by Vitaly Lipatov's avatar Vitaly Lipatov

serv: add runit support (Void Linux)

parent 9691f56e
......@@ -76,6 +76,9 @@ case $DISTRNAME in
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="service-chkconfig"
;;
VoidLinux)
CMD="runit"
;;
Slackware)
CMD="service-initd"
;;
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -40,6 +40,9 @@ serv_common()
sudocmd systemctl "$@" $SERVICE
fi
;;
runit)
sudocmd sv $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -42,6 +42,9 @@ serv_disable()
systemd)
sudocmd systemctl disable $1
;;
runit)
sudocmd rm -fv /var/service/$SERVICE
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -46,6 +46,11 @@ __serv_enable()
systemd)
sudocmd systemctl enable $1
;;
runit)
assure_exists $SERVICE
[ -r "/etc/sv/$SERVICE" ] || fatal "Can't find /etc/sv/$SERVICE"
sudocmd ln -s /etc/sv/$SERVICE /var/service/
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -39,6 +39,9 @@ serv_restart()
systemd)
sudocmd systemctl restart $SERVICE "$@"
;;
runit)
sudocmd sv restart "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -37,6 +37,9 @@ serv_start()
systemd)
sudocmd systemctl start "$SERVICE" "$@"
;;
runit)
sudocmd sv up "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -36,6 +36,9 @@ is_service_running()
systemd)
$SUDO systemctl status $1 >/dev/null
;;
runit)
$SUDO sv status "$SERVICE" >/dev/null
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -63,6 +66,9 @@ is_service_autostart()
systemd)
$SUDO systemctl is-enabled $1
;;
runit)
test -L /var/service/$SERVICE
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -90,6 +96,9 @@ serv_status()
systemd)
sudocmd systemctl status $SERVICE "$@"
;;
runit)
sudocmd sv status "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -37,6 +37,9 @@ serv_stop()
systemd)
sudocmd systemctl stop $SERVICE "$@"
;;
runit)
sudocmd sv down "$SERVICE"
;;
*)
fatal "Have no suitable 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