Improve autostart-manage script

This commit is contained in:
Tobias Reisinger 2022-12-16 21:46:19 +01:00
parent e45acae5b4
commit cf6ef78b67
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 24 additions and 6 deletions

View file

@ -18,13 +18,14 @@ _list () {
}
_echo_table () {
printf "Unit\tFilename\tStatus\n"
printf "Unit\tFilename\tEnabled\tActive\n"
for unit in "$@"
do
printf "%s\t%s\t%s\n" \
printf "%s\t%s\t%s\t%s\n" \
"$unit" \
"$(_filename "$unit")" \
"$(_systemctl "$unit" is-enabled)"
"$(_systemctl "$unit" is-enabled)" \
"$(_systemctl "$unit" is-active)"
done
}
@ -79,7 +80,10 @@ case $1 in
edit) _systemctl "$2" edit --full ;;
enable) _systemctl "$2" add-wants autostart.target ;;
disable) _systemctl "$2" disable ;;
restart) _systemctl "${2:-*}" restart;;
start) _systemctl "${2:-*}" start;;
status) _systemctl "${2:-*}" status ;;
start) systemctl --user start autostart.target ;;
stop) _systemctl "${2:-*}" stop ;;
run) systemctl --user start autostart.target ;;
*) echo "'$1' is not valid" ;;
esac