Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
init script order: How to determine order WITHOUT rebooting?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
overkll
Veteran
Veteran


Joined: 21 Sep 2004
Posts: 1249
Location: Austin, Texas

PostPosted: Fri Oct 12, 2007 2:40 pm    Post subject: init script order: How to determine order WITHOUT rebooting? Reply with quote

Anyone know how to list/determine the order of execution of the initscripts without rebooting?

rc-update can show what will be started, but not the order. Kind of a pain in the ass to try and figure it out by looking at the "depends" function in every init script. I know about the /etc/init.d/<service> (ineed|iuse|needsme|usesme) capability, but again, one needs to look at every script and try to order it up manually.

There should be something simple like "rc-update show order" or "/sbin/rc --pretend". Anyone out there with the answer? Inquiring minds want to know.
Back to top
View user's profile Send private message
overkll
Veteran
Veteran


Joined: 21 Sep 2004
Posts: 1249
Location: Austin, Texas

PostPosted: Sat Oct 13, 2007 2:08 pm    Post subject: Reply with quote

-bump-

Nobody?
Back to top
View user's profile Send private message
overkll
Veteran
Veteran


Joined: 21 Sep 2004
Posts: 1249
Location: Austin, Texas

PostPosted: Mon Oct 15, 2007 2:26 pm    Post subject: Reply with quote

Well, since I didn't think this feature existed, I filed a bug report. Looks like the feature will be added to baselayout-2.0.0_rc6. :)
Back to top
View user's profile Send private message
nordic bro
Guru
Guru


Joined: 25 Oct 2003
Posts: 585

PostPosted: Mon Oct 15, 2007 4:33 pm    Post subject: Reply with quote

Sweet. I'm glad nobody answered your post :)
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Mon Oct 15, 2007 6:19 pm    Post subject: Reply with quote

Actually, I did answer, but I quickly deleted my post when I discovered it wasn't 100% accurate. :?
I recommended this:
Code:
source /lib/rcscripts/sh/rc-services.sh
list=""
for x in /var/lib/init.d/softscripts/*; do list="${list} ${x##*/}"; done
trace_dependencies $list

Near as I could tell from reading the source, that's how /sbin/rc determines the script order when changing runlevels. Yet it doesn't match my boot order (e.g., local is listed somewhere in the middle) so I must have overlooked something. I'd be interested to know what....
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
overkll
Veteran
Veteran


Joined: 21 Sep 2004
Posts: 1249
Location: Austin, Texas

PostPosted: Mon Oct 15, 2007 6:37 pm    Post subject: Reply with quote

When I was digging around for an answer, I came across /var/lib/init.d/deptree. AFAIK, this is where the order is stored. I didn't feel like trying to decifer it at the time.
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Mon Oct 15, 2007 7:08 pm    Post subject: Reply with quote

Yes, that is the dependency tree. It's essentially the depends information from the init scripts (need, before, after, etc.) recast as a collection of bash arrays. The trace_dependencies function from /lib/rcscripts/sh/rc-services.sh uses that structure to determine the ordered dependencies of any given script. The section of /sbin/rc that starts services is little different from what I posted above, yet the order comes out different...puzzling.
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jan 02, 2008 1:27 pm    Post subject: Reply with quote

You need to fake a function like so after sourcing rc-services.sh

is_runlevel_start() { return 0; }

trace_dependencies works differently if a runlevel is starting or stopping.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum