Commit 04bc80ba authored by Vitaly Lipatov's avatar Vitaly Lipatov

serv list: improve speed with run sudo once

parent 8aa92b13
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
# List running services # List running services
serv_list() serv_list()
{ {
info "Running services:"
case $SERVICETYPE in case $SERVICETYPE in
# service-chkconfig) # service-chkconfig)
# ;; # ;;
...@@ -33,9 +34,11 @@ serv_list() ...@@ -33,9 +34,11 @@ serv_list()
sudocmd systemctl list-units $@ sudocmd systemctl list-units $@
;; ;;
*) *)
# hack to improve list speed
[ "$UID" = 0 ] || { sudocmd $PROGDIR/serv --quiet list ; return ; }
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 $(quiet=1 serv_list_all) ; do
is_service_running $i >/dev/null && echo $i is_service_running $i >/dev/null && echo $i
done done
;; ;;
......
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