Commit 74d9fb44 authored by Vitaly Lipatov's avatar Vitaly Lipatov

serv: some anyssh fixes

parent c77dec4f
...@@ -104,6 +104,7 @@ ANYSYSDDIR="/lib/systemd/system" ...@@ -104,6 +104,7 @@ ANYSYSDDIR="/lib/systemd/system"
} }
# TODO: done it on anyservice part
is_anyservice() is_anyservice()
{ {
local SERVICE="$1" local SERVICE="$1"
...@@ -111,8 +112,11 @@ is_anyservice() ...@@ -111,8 +112,11 @@ is_anyservice()
[ -n "$ANYSERVICE" ] || return 1 [ -n "$ANYSERVICE" ] || return 1
# not, if there is regular service with the name # not, if there is regular service with the name
[ -d "$INITDIR/$SERVICE" ] && return 1 [ -d "$INITDIR/$SERVICE" ] && return 1
# yes, if the service is anyservice driven # yes, the service is anyservice driven
[ -r "$ANYSERVDIR/$SERVICE.service" ] [ -r "$ANYSERVDIR/$SERVICE.service" ] && return 0
# yes, the service can be anyservice driven
[ -r "$ANYSYSDDIR/$SERVICE.service" ] && return 0
return 1
} }
......
...@@ -29,8 +29,7 @@ __serv_enable() ...@@ -29,8 +29,7 @@ __serv_enable()
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig) service-chkconfig)
# can't use is_anyservice here if is_anyservice $SERVICE ; then
if [ ! -d "$INITDIR/$SERVICE" ] && [ -n "$ANYSERVICE" ] && [ -r "$ANYSYSDDIR/$SERVICE.service" ] ; then
sudocmd anyservice $SERVICE on sudocmd anyservice $SERVICE on
return return
fi fi
......
...@@ -49,10 +49,12 @@ is_service_autostart() ...@@ -49,10 +49,12 @@ is_service_autostart()
case $SERVICETYPE in case $SERVICETYPE in
service-chkconfig|service-upstart) service-chkconfig|service-upstart)
if is_anyservice $1 ; then if is_anyservice $1; then
# if is registered, assume it is autostarted # HACK: if is registered, assume it is autostarted
return 0 [ -r "$ANYSERVDIR/$SERVICE.service" ]
return
fi fi
# FIXME: check for current runlevel # FIXME: check for current runlevel
LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on" LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on"
;; ;;
......
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