Detect Linux Runlevel

Michael Torrie torriem at
Mon Dec 5 17:44:54 EST 2016

On 12/05/2016 03:29 PM, Marko Rauhamaa wrote:
> Chris Angelico <rosuav at>:
>> On Tue, Dec 6, 2016 at 8:38 AM, Lew Pitcher
>> <lew.pitcher at> wrote:
>>> The OP asked for the runlevel, not the systemd target.
>> Runlevels don't exist in systemd. And systemd targets don't exist in
>> Upstart. The question "what runlevel are we in" does not make sense
>> unless you're using an init system that works on the basis of
>> runlevels (eg sysvinit).
> In fact, systemd is not an init system for Linux. Linux is the kernel of
> the systemd operating system. Systemd is the
>       One Ring to rule them all, One Ring to find them,
>    One Ring to bring them all and in the darkness bind them

Well I for one am glad of the systemd init system inside of my Linux
operating system.  I would far rather deal with service ini files than
long arcane bash scripts that often re-implement (poorly) things like
pid files, and attempts to prevent more than one instance from running.
You were the one that posted earlier today about the many perils of
programming complicated scripts in bash. Init scripts pretty much hit on
all of those gotchas!  It boggles my mind that people would actually
argue in favor of maintaining such things (and yes I have done it on
many servers over the years and it was always a pain to deal with custom

I don't use very many of the systemd modules (most are not even
installed on my machine), nor will I ever need them. In fact I still
have rsyslog running.

More information about the Python-list mailing list