Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
You can see above how many runlevels are there in Linux and what each of them means.
To enter any other desired runlevel, issue this command:
Code:
init 3
to reboot the system and get into runlevel 3.
To restart:
Code:
init 6
To shutdown:
Code:
init 0
Do not set the above 2 values in the following line:
Keep in mind that there is no real standard about what to run in which runlevel. For example, Debian is running in runlevel 2 with GUI and network enabled, and runlevels 2-5 are actually all the same.
I don't know if using [QUOTE][/QUOTE] tags for a code snippet was deliberate or an accident, I suspect the latter because I don't recall seeing you make that mistake before. Please edit your post to put your code in a Code block, i.e. inside BBcode [CODE][/CODE] tags. Thanks.
Also, FWIW, runlevel doesn't work on my MEPIS 8.0 box, but who -r does.
Looking at the manpage for "runlevel", it shows three ways of determining the runlevel:
/sbin/runlevel
who -r
The environment variables RUNLEVEL & PREVLEVEL.
On openSUSE
I looked in the service startup scripts in /etc/init.d/ and they use $RUNLEVEL and $PREVLEVEL.
The file /etc/rc.status has a function rc_runlevel() that defines these two variables if they don't exist:
If you want to know a runlevel in a startup script, examine startup scripts in your system to see how they do it. Be aware whether the RUNLEVEL and PREVLEVEL environment variables exist when your script is run.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.