Commit 658c5f05 authored by Vitaly Lipatov's avatar Vitaly Lipatov

serv: fixes for systemd after real use

parent 4d507e35
......@@ -30,13 +30,13 @@ serv_list()
sudocmd service --status-all
;;
systemd)
sudocmd systemctl list-units
sudocmd systemctl list-units $@
;;
*)
load_helper serv-list_all
load_helper serv-status
for i in $(serv_list_all) ; do
is_service_running $i && echo $i
is_service_running $i >/dev/null && echo $i
done
;;
esac
......
......@@ -29,7 +29,7 @@ serv_list_all()
sudocmd ls -1 /etc/init.d/* | sed -e "s|/etc/init.d/||g" | grep -v README
;;
systemd)
sudocmd systemctl list-unit-files
sudocmd systemctl list-unit-files $@
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
......
......@@ -31,7 +31,12 @@ serv_list_startup()
# sudocmd systemctl list-unit-files
# ;;
*)
fatal "Have no suitable command for $SERVICETYPE"
load_helper serv-list_all
load_helper serv-status
for i in $(serv_list_all | cut -f 1 -d" " | grep "\.service$") ; do
is_service_autostart >/dev/null $i && echo $i
done
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013 Etersoft
# Copyright (C) 2012, 2013 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -28,8 +28,7 @@ is_service_running()
$SUDO /etc/init.d/$1 status >/dev/null
;;
systemd)
#sudocmd systemctl is-enabled $1
fatal "FIXME: don't know how detect current startup state"
$SUDO systemctl status $1 >/dev/null
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
......@@ -48,7 +47,7 @@ is_service_autostart()
fatal "FIXME: don't know how detect current startup state"
;;
systemd)
sudocmd systemctl is-enabled $1.service
$SUDO systemctl is-enabled $1
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
......@@ -58,7 +57,7 @@ is_service_autostart()
serv_status()
{
is_service_autostart $1 && echo "Service $1 is sheduled to run on startup" || echo "Service $1 will NOT run on startup"
is_service_autostart $1 && echo "Service $1 is scheduled to run on startup" || echo "Service $1 will NOT run on startup"
local SERVICE="$1"
shift
......@@ -71,7 +70,7 @@ serv_status()
sudocmd /etc/init.d/$SERVICE status "$@"
;;
systemd)
sudocmd systemctl status $SERVICE.service "$@"
sudocmd systemctl status $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
......
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