LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 08-28-2009, 03:17 AM   #1
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
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 ?
 
Old 08-29-2009, 02:52 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
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
 
Old 08-29-2009, 03:04 PM   #3
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Rep: Reputation: 37
I also thought the same, rc.local should do what you are looking for, if we are not misinterpreting.
 
Old 08-31-2009, 03:25 AM   #4
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Original Poster
Rep: Reputation: 100Reputation: 100
Oops ! Should have been clearer !

I wanna know if lilo can lead to the execution of a command, like rc.local does.
 
Old 08-31-2009, 04:36 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
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.
 
Old 08-31-2009, 04:51 AM   #6
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
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.....
 
Old 08-31-2009, 05:08 AM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by zhjim View Post
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.
 
Old 08-31-2009, 06:04 AM   #8
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
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.
 
Old 08-31-2009, 10:12 AM   #9
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Original Poster
Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by i92guboj View Post
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 ?
 
Old 08-31-2009, 10:13 AM   #10
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Original Poster
Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by zhjim View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script - I want some time delay between each command is executed bbmak Linux - Newbie 2 12-21-2007 03:35 AM
how can pass noapic noacpi in boot option rddreamz Linux - Newbie 1 05-11-2004 12:18 PM
Change LILO boot order ??? glenn69 Linux - Newbie 2 04-24-2004 07:01 PM
No effect when 'export' command executed in a script? sylvain_gnu Linux - Software 6 04-20-2004 07:15 PM
Lilo boot order BicycleBob Linux - General 3 10-27-2003 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration