diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-11-19 12:48:15 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-11-19 12:48:15 +0200 |
commit | 2e1222f2584455d5a00bec6d7fcbe22b6d4cd540 (patch) | |
tree | 8fa06d036175d8387e51f06b7e687d79aa50d4af /installer | |
parent | 25390937871649f2d8ec5b9e8aa85be66ed3e073 (diff) |
use rc-service instead of service on openrc when service is not available
Diffstat (limited to 'installer')
-rw-r--r-- | installer/functions.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/installer/functions.sh b/installer/functions.sh index f186641944..a5449faf4e 100644 --- a/installer/functions.sh +++ b/installer/functions.sh @@ -120,6 +120,7 @@ netdata_banner() { # portable service command service_cmd="$(which_cmd service)" +rcservice_cmd="$(which_cmd rc-service)" systemctl_cmd="$(which_cmd systemctl)" service() { local cmd="${1}" action="${2}" @@ -132,6 +133,10 @@ service() { then run "${service_cmd}" "${cmd}" "${action}" return $? + elif [ ! -z "${rcservice_cmd}" ] + then + run "${rcservice_cmd}" "${cmd}" "${action}" + return $? fi return 1 } @@ -488,8 +493,15 @@ install_netdata_service() { if [ ${ret} -eq 0 ] then - NETDATA_START_CMD="service netdata start" - NETDATA_STOP_CMD="service netdata stop" + if [ ! -z "${service_cmd}" ] + then + NETDATA_START_CMD="service netdata start" + NETDATA_STOP_CMD="service netdata stop" + elif [ ! -z "${rcservice_cmd}" ] + then + NETDATA_START_CMD="rc-service netdata start" + NETDATA_STOP_CMD="rc-service netdata stop" + fi fi return ${ret} |