Commit c77dec4f authored by Vitaly Lipatov's avatar Vitaly Lipatov

anyservice support fixes

parent 5c4ea95c
......@@ -98,7 +98,7 @@ is_active_systemd && CMD="systemd"
SERVICETYPE=$CMD
ANYSERVICE=$(which anyservice 2>/dev/null >/dev/null)
ANYSERVICE=$(which anyservice 2>/dev/null)
ANYSERVDIR="/etc/systemd-lite"
ANYSYSDDIR="/lib/systemd/system"
......
......@@ -23,6 +23,8 @@ load_helper serv-status
# Enable service by default
serv_disable()
{
local SERVICE="$1"
is_service_running $1 && { serv_stop $1 || return ; }
is_service_autostart $1 || { echo "Service $1 already disabled for startup" && return ; }
......
......@@ -21,9 +21,10 @@ load_helper serv-start
load_helper serv-status
# Enable service by default
serv_enable()
__serv_enable()
{
is_service_running $1 || serv_start $1 || return
local SERVICE="$1"
is_service_autostart $1 && echo "Service $1 already enabled for startup" && return
case $SERVICETYPE in
......@@ -52,3 +53,10 @@ serv_enable()
esac
}
serv_enable()
{
__serv_enable "$1" || return
# start if need
is_service_running $1 || serv_start $1 || return
}
......@@ -20,9 +20,11 @@
# FIXME: sudo ask password, but we do not print command before
is_service_running()
{
local SERVICE="$1"
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
if is_anyservice $1 ; then
$SUDO anyservice $1 status >/dev/null
return
fi
......@@ -43,9 +45,11 @@ is_service_running()
# FIXME: sudo ask password, but we do not print command before
is_service_autostart()
{
local SERVICE="$1"
case $SERVICETYPE in
service-chkconfig|service-upstart)
if is_anyservice $SERVICE ; then
if is_anyservice $1 ; then
# if is registered, assume it is autostarted
return 0
fi
......
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