tui-scripts/s

15 lines
482 B
Plaintext
Raw Normal View History

2024-03-16 15:34:40 +00:00
#!/bin/bash
set -e
cat > /tmp/.dialogrc << EOL
# Item color
tag_color = (BLACK,WHITE,ON)
EOL
2024-03-16 16:48:00 +00:00
service=$(systemctl list-units --type service --all --plain --quiet | awk '{ print $1 }' | fzf --multi --cycle --reverse --preview 'systemctl status {1}')
2024-03-16 15:34:40 +00:00
set +ex
2024-03-16 16:48:00 +00:00
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)
2024-03-16 15:34:40 +00:00
if [ ! -z $action ]; then
sudo systemctl ${action,,} $service
fi