lib: fixfix
authorTero Marttila <tero.marttila@aalto.fi>
Thu, 26 Feb 2015 23:22:32 +0200
changeset 633 16eaaf30d218
parent 632 711be783d0a1
child 634 8ec17e8d16c0
lib: fixfix
lib/pvl/service.sh
lib/pvl/test.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/pvl/service.sh	Thu Feb 26 23:22:32 2015 +0200
@@ -0,0 +1,48 @@
+service_GETOPTS=''
+
+SERVICE_NOOP=
+SERVICE_TYPE=
+
+function service_help {
+    echo <<EOM
+
+EOM
+}
+
+function service_opt {
+    local opt=$1
+    local optarg="$2"
+
+    case $opt in
+        n)  SERVICE=0 ;;
+        *)  return 1
+    esac
+}
+
+function service_init {
+    if [ -e /bin/systemctl ]; then
+        SERVICE_TYPE=systemd
+
+    elif [ -e /sbin/initctl ]; then
+        SERVICE_TYPE=upstart
+
+    else
+        SERVICE_TYPE=service
+    fi
+}
+
+function service_status {
+    local service=$1
+
+    if [ $SERVICE_TYPE = upstart ]; then
+        cmd_test service $service status | grep -q start
+    else
+        cmd_test service $service status > /dev/null
+    fi
+}
+
+function service_restart {
+    local service=$1
+
+    cmd service $service restart
+}
--- a/lib/pvl/test.sh	Thu Feb 26 23:20:37 2015 +0200
+++ b/lib/pvl/test.sh	Thu Feb 26 23:22:32 2015 +0200
@@ -8,7 +8,7 @@
     local cmd="$2"
 
     if cmd_test "$cmd" -q "${@:3}"; then
-        log_skip "$src: test: OK"
+        log_debug "$src: test: OK"
 
     else
         log_error "$src: test: Failed"