View previous topic :: View next topic |
Author |
Message |
goldfita n00b
Joined: 27 Nov 2005 Posts: 40
|
Posted: Thu Feb 16, 2006 6:20 am Post subject: run script before swapon how? |
|
|
Hi,
I need to run
/etc/init.d/dumputils start
before my swap is turned on. I entered that exactly right before swapon in /sbin/rc. For some reason it appears that it's not running at all. This is a script that configures and starts the lkcd utility for kernel debugging. I just want to know how I can get it running before swapon? Can I just add it to a runlevel? Which one?
Alternatively I could disable swapon and do all this manually. But I'm not convinced it's being run from there. |
|
Back to top |
|
|
zsoltika l33t
Joined: 13 Nov 2003 Posts: 634 Location: Budapest, Hungary
|
Posted: Thu Feb 16, 2006 8:34 am Post subject: |
|
|
As far as I can see while booting the '/etc/init.d/localmount' script takes care of swapon. So you can add your initscript to the previous one's 'depend' list. Or just simply edit the 'localmount' script and add your prefered lines before the line.
HTH _________________ Do not believe that Guru thing under my nickname. |
|
Back to top |
|
|
Leo Lausren Apprentice
Joined: 24 Feb 2004 Posts: 198 Location: Denmark
|
Posted: Thu Feb 16, 2006 10:36 am Post subject: Re: run script before swapon how? |
|
|
goldfita wrote: | I need to run
/etc/init.d/dumputils start
before my swap is turned on. |
How about putting: Code: | depend() {
before localmount
} | in your dumputils script _________________ Blog: common sense – nonsense |
|
Back to top |
|
|
goldfita n00b
Joined: 27 Nov 2005 Posts: 40
|
Posted: Thu Feb 16, 2006 5:47 pm Post subject: |
|
|
Quote: |
How about putting:
Code:
depend() {
before localmount
}
in your dumputils script
|
I saw that /sbin/rc was in inittab under start scripts or something like that. So I thought that was my best bet. Do I need to then add dumputils to a runlevel? I'm wondering how gentoo knows to run that script before local mount. Does it read through all the depend functions before running any scripts? Or is this checked when you rc-update? |
|
Back to top |
|
|
ecatmur Advocate
Joined: 20 Oct 2003 Posts: 3595 Location: Edinburgh
|
|
Back to top |
|
|
goldfita n00b
Joined: 27 Nov 2005 Posts: 40
|
Posted: Thu Feb 16, 2006 8:30 pm Post subject: |
|
|
I added dumputils to boot with rc-update after adding the dependency mentioned before. I see the usage message displayed 3 times at startup. But it was never actually run. The usage script looks like
dumputils {start|stop|reload|force-reload|restart}
Was there something else? |
|
Back to top |
|
|
goldfita n00b
Joined: 27 Nov 2005 Posts: 40
|
Posted: Fri Feb 17, 2006 3:31 am Post subject: |
|
|
Ok, I got it. I had to rewrite it using functions and remove the case statement and exit commands.
I can see it running at startup now. But I'm not convinced it's happening at the correct time. It appears to be happening right before the ethernet interface is brought up, which is in the default run level. So unless localmount has no output, something must be wrong. Is there anyway I can verify the script load order? 'rc-update show' shows dumputils in boot.
thanks |
|
Back to top |
|
|
ecatmur Advocate
Joined: 20 Oct 2003 Posts: 3595 Location: Edinburgh
|
|
Back to top |
|
|
Leo Lausren Apprentice
Joined: 24 Feb 2004 Posts: 198 Location: Denmark
|
Posted: Fri Feb 17, 2006 1:01 pm Post subject: |
|
|
goldfita wrote: | Ok, I got it. I had to rewrite it using functions and remove the case statement and exit commands.
But I'm not convinced it's happening at the correct time. |
It seems that swapon is called at sometime before localmount, possibly from /sbin/rc (as you noted),
together vith udev pts and such.
You will probably need to take the functional part (ie. the start function's content) and add it to /sbin/rc
or maybe call the script with the argument "start" from there. _________________ Blog: common sense – nonsense |
|
Back to top |
|
|
goldfita n00b
Joined: 27 Nov 2005 Posts: 40
|
Posted: Fri Feb 17, 2006 6:32 pm Post subject: |
|
|
Quote: |
It seems that swapon is called at sometime before localmount, possibly from /sbin/rc (as you noted),
together vith udev pts and such. |
The swapon command is in rc (under runlevel sysinit I think), but as far as I can tell, that code is never executed. No matter what I put there, it isn't getting executed. I tried the scripy and copy/pasting the commands right in there. It must be getting turned on somewhere else.
Thanks for your help. I might give up on this. It's no longer critical to get this script running. |
|
Back to top |
|
|
goldfita n00b
Joined: 27 Nov 2005 Posts: 40
|
Posted: Fri Feb 17, 2006 8:21 pm Post subject: |
|
|
I was able to verify the order using log files. Despite depend, localmount is running first. And that's where swapon is being run. |
|
Back to top |
|
|
synss Apprentice
Joined: 08 Mar 2006 Posts: 282 Location: Dijon > Berlin > Tokyo > Nürnberg > München
|
Posted: Thu May 04, 2006 6:13 pm Post subject: |
|
|
Hello,
I pop in to say that even /etc/init.d/test Code: | #!/sbin/runscript
depend() {
before bootmisc
}
start() {
einfo "Hum... I am late"
ewarn "The before thing does not work that well in the boot runlevel!"
} |
rc-update add test boot And that is also true with before localmount and others, even hdparm that is not home-made (synss-made) does not start before bootmisc as depend() suggests... That's a bug right?
As such, test is the last script executed at the boot runlevel (on x86, with everything up-to-date, but that's a while I noticed that)
[EDIT] The issue is known and addressed in sys-apps/baselayout-1.12* now in the ~x86 branch. _________________ Compress portage tree
Elog viewer
Autodetect swap |
|
Back to top |
|
|
damogran n00b
Joined: 12 Jan 2005 Posts: 43
|
Posted: Mon Jun 19, 2006 11:50 am Post subject: |
|
|
Hi,
i got that kind of problem too.
I need to load an init script before the localmount init script starts. I've read the gentoo init script guide an played with the depend / before / need stuff in the init scripts. but without success.
The depend part of my initscript (called dasd_init):
Code: | depend() {
before localmount
after modules
}
|
... and from localmount
Code: | depend() {
after checkfs dasd_init
} |
Why is localmount still starting before dasd_init?
<- |
|
Back to top |
|
|
synss Apprentice
Joined: 08 Mar 2006 Posts: 282 Location: Dijon > Berlin > Tokyo > Nürnberg > München
|
|
Back to top |
|
|
|