--- branches/magellan-next/include/mtools.minc 2011/06/02 18:01:44 17 +++ branches/magellan-next/include/mtools.minc 2011/06/02 18:16:14 18 @@ -1,4 +1,4 @@ -# $Header: /magellan-cvs/mage/include/mtools.minc,v 1.3 2008/02/10 12:13:56 niro Exp $ +# $Id$ # adds services to runlevels and starts them # mstartservice service {/path/to/service_exec} @@ -7,6 +7,13 @@ local service="$1" local service_exec="$2" + # only run if sysV init was found + if [[ ! -f /etc/rc.d/init.d/functions ]] + then + echo "sysV init not found, not adding service ${service} to runlevels!" + return + fi + [[ -z ${service_exec} ]] && service_exec="$(which ${service})" # add service to default runlevels @@ -35,6 +42,13 @@ local service="$1" local service_exec="$2" + # only run if sysV init was found + if [[ ! -f /etc/rc.d/init.d/functions ]] + then + echo "sysV init not found, not adding service ${service} to runlevels!" + return + fi + [[ -z ${service_exec} ]] && service_exec="$(which ${service} 2> /dev/null)" # only stop the service if ${service_exec} does not exist @@ -64,6 +78,13 @@ local service="$1" local service_exec="$2" + # only run if sysV init was found + if [[ ! -f /etc/rc.d/init.d/functions ]] + then + echo "sysV init not found, not adding service ${service} to runlevels!" + return + fi + [[ -z ${service_exec} ]] && service_exec="$(which ${service} 2> /dev/null)" # do not stop services on bootstrap or MROOT!=/