View previous topic :: View next topic |
Author |
Message |
Vieri l33t
Joined: 18 Dec 2005 Posts: 887
|
Posted: Wed Apr 13, 2011 8:42 am Post subject: [SOLVED] rc init scripts |
|
|
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 |
|
|
Wormo Retired Dev
Joined: 29 Nov 2004 Posts: 526 Location: SB County California
|
Posted: Sat Apr 16, 2011 10:33 pm Post subject: |
|
|
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 |
|
|
Thistled Guru
Joined: 06 Jan 2011 Posts: 572 Location: Scotland
|
Posted: Tue Apr 19, 2011 1:23 am Post subject: |
|
|
So is this topic [solved]? _________________ Whatever you do, do it properly! |
|
Back to top |
|
|
Vieri l33t
Joined: 18 Dec 2005 Posts: 887
|
Posted: Tue Apr 19, 2011 1:35 pm Post subject: |
|
|
Wormo wrote: | A little shell scripting |
Thanks! |
|
Back to top |
|
|
|