You are not logged in.
Is there a script to list all active systemd units for use in conky. ie an equivelent to "rc.d list -s"
Offline
does "systemctl list-units --full | grep active" do what you're looking for?
Desktop/Laptop - DWM :: VM - screen
Registered Linux User Number 483137 :: Victory! :: GitHub
Offline
I was thinking about the following if you're just wanting services:
systemctl list-units -t service --no-pager --no-legend | grep active
edit: While I'm here, here's a script I wrote which allows you to manipulate services using a function and dmenu. The final output is piped in monospace font to gxmessage, but of course you can hack this around in lots of ways.
#!/bin/bash
#
services()
{
sm="dmenu -l 20 -fn Monospace-8 -p"
s1=$(systemctl list-unit-files -t service --no-legend | $sm Service); s1=${s1/%service*/service}; [[ -z $s1 ]] && exit
s2=$(echo -e "status\nstart\nstop\nrestart\nenable\ndisable" | $sm "Action"); [[ -z $s2 ]] && exit
if [[ $s2 == "status" ]]; then unset s3; else s3="gksudo --"; fi
eval $s3 systemctl --no-pager $s2 $s1 2>&1 | gxmessage -file - -title Services -center -fn "Monospace 8"
}
services
Last edited by ninian (2012-11-23 00:46:46)
Offline
Thank you kindly
I ended up using this if anyone else could use it here it is
systemctl list-units -t service --no-pager --no-legend | grep active | grep -v systemd | grep -v exited | awk '{ print $1 }'
Last edited by tsr-nc (2012-11-23 19:24:15)
Offline