Once upon a time I wrote a zenity-GUI myself. In short words: It looks for files in init.d, greps for the case statements, and tries to guess what should be displayed on the fly.
Maybe it doesn't work well for all services, but for my work (cups, postgresql, ...) it's sufficient.
As a side note, it shows how to dynamically fit your window to screensize (maximum) and content size (width, length).
Here it is:
#!/bin/bash
#
# oetv.sh
# Show all servives in /etc/init.d in a list, and let the user choose how to start it.
#
# (c) 2008 Stefan Wagner, license GPLv3
#
# Search /etc/init.d/ for all executable files
# Get their number, and the maximum name size to produce a fitting window
width=0
height=0
# The font will influence the optimal window size
# But I don't know how to get them.
# Probably depending on windowmanager, desktop, usersettings
function xyFromList
{
anz=0
wmax=0
for file in $1
do
anz=$((anz+1))
len=${#file}
[ $len -gt $wmax ] && wmax=$len
done;
width=$((wmax*9+50))
height=$((anz*26+160))
}
dienstlist=$(ls /etc/init.d/ )
xyFromList "$dienstlist"
dienst=$(zenity --width=$width --height=$height --list --text "Service schalten" --column "Dienst" $dienstlist)
[ "foo"$dienst == "foo" ] && exit
# select options for the service, and display an apropriate window
optionen=$(egrep -h "[a-z]+\)" /etc/init.d/$dienst | sed 's/^[ \t]*//;s/).*/)/;s/#.*//;s/)//g;s/|/ /g' | sort -u)
xyFromList "$optionen"
aktion=$(zenity --width=$width --height=$height --list --text "Service schalten" --column "Befehl" $optionen)
[ "foo"$aktion == "foo" ] && exit
result=$(gksudo /etc/init.d/$dienst $aktion)
zenity --info "$aktion" --text "$result"
Welcome to Super User! On this Q&A site we value answers. Hyperlinks alone tend to point toward an answer without actually being one. Please edit your answer so that it includes the essential elements from your linked source.
– I say Reinstate Monica – 2016-08-11T00:37:38.213Or convert this into a comment instead – rogerdpack – 2016-08-17T15:46:25.177
Unfortunately, this repository does not exist anymore, and I cannot find any other GUI application doing that thing – Boiethios – 2019-06-08T16:57:48.207
This is the same repository. GuillaumeGomez/systemd-manager
– Animesh – 2020-01-16T07:13:07.637