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