LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Pass an option to LILO in order to have a script/command executed at/after boot ? (https://www.linuxquestions.org/questions/linux-general-1/pass-an-option-to-lilo-in-order-to-have-a-script-command-executed-at-after-boot-750814/)

Linux.tar.gz 08-28-2009 03:17 AM

Pass an option to LILO in order to have a script/command executed at/after boot ?
 
Hi !

I have one distro installed, LILO as the boot loader, and i wonder if it's possible to duplicate the lilo entries with an option which executes some script or command during, or after the boot.

Actually, i installed a Slackware + autolaunching virtual machine, but i have two VM, so i need to autolaunch one of them. May i choose it from the very beginning ?

GrapefruiTgirl 08-29-2009 02:52 PM

Not sure about other members, but I can't really understand what exactly the situation is here, nor quite what you're asking.
I see you have lots of posts, so I am guessing you're not *new* to Slackware and may already know what I'm going to post here:

I will try to answer at least *one* question for you. To execute a command or script after boot (kinda during very late boot really) you could use the rc.local script in /etc/rc.d.

Again, sorry if you already know this, but again, I really don't understand the question. Could you re-phrase it to better explain the relationships between the OSs and the VM's ?

Cheers!
Sasha

RaptorX 08-29-2009 03:04 PM

I also thought the same, rc.local should do what you are looking for, if we are not misinterpreting.

Linux.tar.gz 08-31-2009 03:25 AM

Oops ! Should have been clearer !

I wanna know if lilo can lead to the execution of a command, like rc.local does.

i92guboj 08-31-2009 04:36 AM

No.

But you can tell lilo which runlevel to boot at. So you could have three similar entries, but tell the first one to boot at runlevel 3 (console usually), the other at runlevel 5 (usually X), and the other at runlevel 4, for example, and use the 4th runlevel to launch the vm. It's a matter of adding the service or application to the given runlevel, that varies depending on your init system, and it can be more or less complicated depending on the app you want to run. You will need to find a way to ensure that everything that's needed to run the vm is already up, like X for example if needed.

zhjim 08-31-2009 04:51 AM

I just checked on the lilo.conf man pages to see if there might be somekind of optins but nope.
I dunno if I would go with the runlevel to chosse between the two vm's. I'd rather would go with rc.local. Idea. Copy the kernel twice and append -vm1 and -vm2 to the file name. Make two lilo entries and check in rc.local with uname -a which one is loaded and start vm according to it.

There might be a chance that you could use init do do something like this.....

i92guboj 08-31-2009 05:08 AM

Quote:

Originally Posted by zhjim (Post 3663686)
I just checked on the lilo.conf man pages to see if there might be somekind of optins but nope.
I dunno if I would go with the runlevel to chosse between the two vm's. I'd rather would go with rc.local. Idea. Copy the kernel twice and append -vm1 and -vm2 to the file name. Make two lilo entries and check in rc.local with uname -a which one is loaded and start vm according to it.

Well, you can do whatever you want, but it's truly the same thing, and you wouldn't need to copy or symlink your kernel with a different name...

All you need to boot from one or another runlevel is to add the runlevel number to the kernel command line, a simple number. Then just add whatever command you use to run the vm to the right runlevel rc file instead of rc.local.

Quote:

There might be a chance that you could use init do do something like this.....
rc files are all part of the init system, including rc.local... You can use whatever system you feel is better, however I have the impression that you should first research a bit about the init system of your distribution so you can learn which option if the best for you.

zhjim 08-31-2009 06:04 AM

Quote:

Originally Posted by i92guboj
rc files are all part of the init system, including rc.local...

I meant the init process itself.

You can use the -z option with an argument with init. Taken from the man pages the argument is ignored but ps will show it. So you can skim through ps or /proc/1/cmdline to make the decision.

Linux.tar.gz 08-31-2009 10:12 AM

Quote:

Originally Posted by i92guboj (Post 3663677)
No.

But you can tell lilo which runlevel to boot at. So you could have three similar entries, but tell the first one to boot at runlevel 3 (console usually), the other at runlevel 5 (usually X), and the other at runlevel 4, for example, and use the 4th runlevel to launch the vm. It's a matter of adding the service or application to the given runlevel, that varies depending on your init system, and it can be more or less complicated depending on the app you want to run. You will need to find a way to ensure that everything that's needed to run the vm is already up, like X for example if needed.

Is it complicated to create my own runlevel ?

Linux.tar.gz 08-31-2009 10:13 AM

Quote:

Originally Posted by zhjim (Post 3663686)
I just checked on the lilo.conf man pages to see if there might be somekind of optins but nope.
I dunno if I would go with the runlevel to chosse between the two vm's. I'd rather would go with rc.local. Idea. Copy the kernel twice and append -vm1 and -vm2 to the file name. Make two lilo entries and check in rc.local with uname -a which one is loaded and start vm according to it.

There might be a chance that you could use init do do something like this.....

Mmm clever.
I like tricks like this.


All times are GMT -5. The time now is 07:04 PM.