tui-scripts/tui-scripts_1.10-1/usr/local/bin/s

16 lines
530 B
Plaintext
Raw Normal View History

2024-04-06 14:43:20 +00:00
#!/bin/bash
set -e
trap 'clear' SIGINT
cat > /tmp/.dialogrc << EOL
# Item color
tag_color = (BLACK,WHITE,ON)
EOL
service=$(systemctl list-units --type service --all --plain --quiet | awk '{ print $1 }' | fzf --multi --cycle --reverse --preview 'SYSTEMD_COLORS=1 systemctl status --no-pager {1}')
set +ex
action=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --menu "Choose the action for $service" 10 40 0 "Start" 1 "Stop" 2 "Disable" 3 "Enable" 4)
if [ ! -z $action ]; then
sudo systemctl ${action,,} $service
fi