Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] rc init scripts
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
Vieri
l33t
l33t


Joined: 18 Dec 2005
Posts: 887

PostPosted: Wed Apr 13, 2011 8:42 am    Post subject: [SOLVED] rc init scripts Reply with quote

What's the simplest way to make sure that all init scripts in the current runlevel are in "started" state and if not, start them. However, do NOT stop services that do not belong to the runlevel.

I noticed that if my runlevel contains:
service1
service2

and I manually start service3 and stop service2

and I finally run "rc" from command line then:

service2 is brought back up automatically BUT service3 is stopped.

So how do I tell "rc" NOT to stop services...?

Thanks


Last edited by Vieri on Tue Apr 19, 2011 1:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
Wormo
Retired Dev
Retired Dev


Joined: 29 Nov 2004
Posts: 526
Location: SB County California

PostPosted: Sat Apr 16, 2011 10:33 pm    Post subject: Reply with quote

That's a little different from the standard runlevel concept, which fully specifies the current set of running services and thus includes stopping ones that don't belong. A little shell scripting will easily do what you want though, e.g.

Code:

for SERVICE in $( rc-status -nc | grep stopped | cut -f2 -d' ' ) ; do
  /etc/init.d/$SERVICE start
done


could be put into a little utility script, or just a bash function defined in root's .bashrc
Back to top
View user's profile Send private message
Thistled
Guru
Guru


Joined: 06 Jan 2011
Posts: 572
Location: Scotland

PostPosted: Tue Apr 19, 2011 1:23 am    Post subject: Reply with quote

So is this topic [solved]?
_________________
Whatever you do, do it properly!
Back to top
View user's profile Send private message
Vieri
l33t
l33t


Joined: 18 Dec 2005
Posts: 887

PostPosted: Tue Apr 19, 2011 1:35 pm    Post subject: Reply with quote

Wormo wrote:
A little shell scripting


Thanks!
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