blob: 4d66ea52fe74ebc6febfa02412558f87031fd6d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/sh
set -e
[ -n "$DEBUG" ] && set -x
export MENU_PROMPT=" rc"
ico=/usr/share/icons/mdi/scalable/run-fast.svg
handle() {
while read -r line; do
svc=$(printf "%s" "${line}" | awk '{print $1}')
mode=$(printf "%s" "${line}" | awk '{print $2}')
act=restart
[ "${mode}" = "started" ] && act=stop
_outp=$(doas rc-service "${svc}" "${act}")
if [ $? = 0 ]; then
notify-send -i "${ico}" -a rc rc "${_outp}"
else
notify-send -i "${ico}" -a rc -u critical -t 30000 rc "${act}ing ${svc} failed:\n<i>${_outp}</i>"
fi
printf "%s\n" "${_outp}"
done
}
rc-status --servicelist |
awk '{printf "%25s\t%s\n", $1, $3}' |
menu --list=10 |
handle
|