systemd: how to get current target

Kevin Kofler kevin.kofler at chello.at
Wed Dec 24 23:22:00 UTC 2014


Glenn Holmer wrote:
> I suppose you could hack up a script based on the runlevel* symlinks in
> /usr/lib/systemd/system, but surely there's a better way?

for i in `seq 2 5` ; do
  systemctl status runlevel$i.target >/dev/null && RUNLEVEL=$i
done
echo $RUNLEVEL

        Kevin Kofler



More information about the kde mailing list