tui-scripts/s

16 lines
521 B
Plaintext
Raw Normal View History

2024-03-16 15:34:40 +00:00
#!/bin/bash
set -e
2024-03-29 06:50:32 +00:00
trap 'clear' SIGINT
2024-03-16 15:34:40 +00:00
cat > /tmp/.dialogrc << EOL
# Item color
tag_color = (BLACK,WHITE,ON)
EOL
2024-04-06 15:20:49 +00:00
service=$(systemctl list-unit-files --type=service --quiet | awk '{ print $1 }' | fzf --multi --cycle --reverse --preview 'SYSTEMD_COLORS=1 systemctl status --no-pager {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