[SOLVED] Is it wrong to execute "telinit 4" in the rc.local ?
SlackwareThis Forum is for the discussion of Slackware Linux.
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.
Is it wrong to execute "telinit 4" in the rc.local ?
Hi !
I have a bunch of cloned virtualized Qemu relative machines.
Some of them need X to be started.
My idea was to check the MAC address, and if the test is OK, launch telinit 4 from within rc.local .
I would say it is not a good idea -that's what runlevels are for. Either change the default entry in /etc/inittab or add 'init 4' to the kernel boot parameters. Doing it this, the Right Way, will allow you to access the box in runlevel 3 in case something happens and the GUI won't come up.
I have a read-only Qemu image with a test script launched by rc.local .
I create many relative images with different MAC addresses.
For some MAC addresses, I'd like the relative machines to start graphically.
The usual and right way to change startup runlevel was mentioned. Now for the reason why not to use rc.local to change it. Take a look at the output of
Quote:
ls /etc/rc*.d/*rc.local*
You will see that its get called in every (multiuser) runlevel. Thus you normaly start into runlevel 3 call rc.local this switches runlevel to 4 which calls rc.local which changes runlevel to 4 which calls rc.local. If telnit actually changes the runlevel if it allready is in the level it ought to change to I do not know. Worse case you have an infinite loop, best case you just change the runlevel. Or you have a script that checks if the runlevel is allready where its ought to be and skips the change of runlevel.
Nother thing to check on if rc.local really is the last thing called in the appropiate runlevel.
I have a read-only Qemu image with a test script launched by rc.local .
I create many relative images with different MAC addresses.
For some MAC addresses, I'd like the relative machines to start graphically.
Put the test at the start of /etc/rc.d/rc.4. Exit if the MAC doesn't match your list. Set /etc/inittab to 4.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.