sysvinit/man/runlevel.8
Jesse Smith 6e8323e9fb The init process now writes the current runlevel to /var/run/runlevel.
This information can be read by the "runlevel" command as well as "halt"
and "reboot". Having the information logged in /var/run/runlevel as
well as the utmp file means systems without utmp (like those running
the musl C library) can still check the current runlevel. This is
useful when running halt/reboot as these programs want to check the
runlevel.

Updated the changelog, and manual pages for halt and runlevel.
2018-07-07 20:19:03 -03:00

59 lines
1.9 KiB
Groff

'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1997 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH RUNLEVEL 8 "May 27, 1997" "" "Linux System Administrator's Manual"
.SH NAME
runlevel -- find the previous and current system runlevel.
.SH SYNOPSIS
.B runlevel
.RI [ utmp ]
.SH DESCRIPTION
.B Runlevel
reads the system
.I utmp
file (typically
.IR /var/run/utmp )
to locate the runlevel record, and then
prints the previous and current system runlevel on its standard output,
separated by a single space. If there is no previous system
runlevel, the letter \fBN\fP will be printed instead.
.PP
If no
.I utmp
file exists, and if no runlevel record can be found in the
.I /var/run/runlevel
file,
.B runlevel
prints the word \fBunknown\fP and exits with an error.
.PP
.B Runlevel
can be used in \fIrc\fP scripts as a substitute for the System-V
\fBwho -r\fP command.
However, in newer versions of \fBinit\fP(8) this information
is also available in the environment variables \fBRUNLEVEL\fP and
\fBPREVLEVEL\fP.
.SH OPTIONS
.\"{{{ utmp
.IP \fIutmp\fP
The name of the \fIutmp\fP file to read.
.\"}}}
.SH SEE ALSO
.BR init (8),
.BR utmp (5)
.SH AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl