Hi folks! I have got some questionS concerning the services which starts at runlevels. First one is: In the /etc/init.d/rc<x>.d directory symbolic links to the appropriate executable files, And there are two links for each program(one for killing it - the name starting with "K", and one for starting - name starting with "S"). So first question is: How the two links pointing to the same file works in a different way, in one case the same file kills the process, in the next it starts...As I know there isn't any parameters for the links? Do I understand it correctly? And next one is: I just want to add something(for example xmms) to start automaticaly in runlevel 5, so in my /etc/init.d/rc5.d directory I created symbolic link to /usr/bin/xmms executable file with a name like S22xmms, I was thinking how to create another link with K22xmms, but didn't find the answer. Anyway it didn't worked after restarting...I tried to add it using chkconfig...like linux:~/Install # chkconfig -a /usr/bin/xmms /usr/bin/xmms: unknown service /usr/bin/xmms: not a runlevel service and in yast's part of System Services (Runlevel) I didn't find anyway to "add" something Is it some default set of programs to start at booting and there can't be added anything? And I was wondering why the numbers of links is not in the increasing order...In my case the /etc/init.d/rc5.d content is: . K05nscd K10microcode and so on...with .. K05postfix K10splash appropriate "S" ones K01cupsrenice K05xdm K10sshd K02powersaved K06cups K12nfs K03haldaemon K07mdnsd K12nfsboot K04cron K10acpid K14portmap K04smbfs K10alsasound K14splash_early I can assume that the same numbers is for the processes to start simultaneously(please correct me if I am not right), but why for example From K07mdnsd comes K10acpid and not K08 acpid? Any help greatly appreciated :) and sorry for a long post Best regards, Sergey -- Sergey Mkrtchyan Scientific Researcher Department of Molecular Physics, Faculty of Physics, Yerevan State University Tel: (374-10) 55-43-41 Fax: (374-10) 57-76-89
On Saturday 20 May 2006 11:40, Sergey Mkrtchyan wrote:
Hi folks!
Hi folk! ;)
I have got some questionS concerning the services which starts at runlevels. First one is: In the /etc/init.d/rc<x>.d directory symbolic links to the appropriate executable files, And there are two links for each program(one for killing it - the name starting with "K", and one for starting - name starting with "S"). So first question is: How the two links pointing to the same file works in a different way, in one case the same file kills the process, in the next it starts...As I know there isn't any parameters for the links? Do I understand it correctly?
1. Did you read /etc/init.d/README and /etc/init.d/skeleton? Also 'man insserv' (the 'DESCRIPTION' section) has usefull info. 2. The glue is /etc/init.d/rc. It calls the S??xxx scripts with the 'start' parameter, and the K??xxx with the stop parameter.
And next one is: I just want to add something(for example xmms) to start automaticaly in runlevel 5, so in my /etc/init.d/rc5.d directory I created symbolic link to /usr/bin/xmms executable file with a name like S22xmms, I was thinking how to create another link with K22xmms, but didn't find the answer.
Use the section between the '### BEGIN INIT INFO' and '### END INIT INFO' marks to indicate when the script should start, and what services it depends on. See /etc/init.d/skeleton, and 'man insserv'.
Anyway it didn't worked after restarting...I tried to add it using chkconfig...like
linux:~/Install # chkconfig -a /usr/bin/xmms /usr/bin/xmms: unknown service /usr/bin/xmms: not a runlevel service
The initscripts need to be in /etc/init.d by convention (LSB I think). Also, when creating a new service, it might be a good idea to start from /etc/init.d/skeleton. You do not need all of it, see the init.d/ directory for plenty of examples. ;)
and in yast's part of System Services (Runlevel) I didn't find anyway to "add" something
YaST probably looks only in /etc/init.d/. The "adding" of a new service should be done e.g. manually by creating a new script in /etc/init.d/. After that, you can "add" (= enable) the service with e.g. YaST, chkconfig or insserv, which creates the appropriate symlinks.
Is it some default set of programs to start at booting and there can't be added anything?
? No.
And I was wondering why the numbers of links is not in the increasing order...In my case the /etc/init.d/rc5.d content is:
. K05nscd K10microcode and so on...with .. K05postfix K10splash appropriate "S" ones K01cupsrenice K05xdm K10sshd K02powersaved K06cups K12nfs K03haldaemon K07mdnsd K12nfsboot K04cron K10acpid K14portmap K04smbfs K10alsasound K14splash_early
Because some scripts do not depend upon eachother; it is possible to start them at the same time (in parallel).
I can assume that the same numbers is for the processes to start simultaneously(please correct me if I am not right), but why for example From K07mdnsd comes K10acpid and not K08 acpid?
The answer is between the '### BEGIN INIT INFO' and '### END INIT INFO' sections (hint: default-start/stop; see 'man insserv' for a better explanation). AFAIK, the assignment of the numbers is done automatically by chkconfig or insserv, and can change after inserting or removing a service. After all, the number itself is not important; only the order is. BTW, doesn't xmms depend on X? If it can run without X, then no worries. Cheers, Leen
On 5/20/06, Leendert Meyer
BTW, doesn't xmms depend on X? If it can run without X, then no worries.
Nice answer, Leendert .. I have recently been learing about this, and it seems that you are right, and as long as skeleton is used as a template and the resulting script is left in /etc/init.d, then when chkconfig runs -- the sym links get added automagically to the rc<x>.d directories, and all is good. But, it seems to me that the init.d process is really intended for service daemons -- isn't xmms just an audio player? I think both KDE and GNOME have a method for "autostarting" user applications like xmms ... from the thread with subjec Amarok Audio Player: "n KDE if you want it to autostart just click on the link in the application menu, drag it into .kde/Autostart (opened in Konqueror) & choose 'Copy here' or 'Link here'." I'm not sure this is exhaustive, but it should point to a better way of auto-starting xmms. Peter
On Saturday 20 May 2006 15:54, Peter Van Lone wrote:
On 5/20/06, Leendert Meyer
wrote: BTW, doesn't xmms depend on X? If it can run without X, then no worries.
Nice answer, Leendert ..
I have recently been learing about this, and it seems that you are right, and as long as skeleton is used as a template and the resulting script is left in /etc/init.d, then when chkconfig runs -- the sym links get added automagically to the rc<x>.d directories, and all is good.
But, it seems to me that the init.d process is really intended for service daemons -- isn't xmms just an audio player?
Yups.
I think both KDE and GNOME have a method for "autostarting" user applications like xmms ...
Good catch, Peter! :) (And I was so close... :P) Of course I knew about it, but since the word 'autostart' was not mentioned, I did not think about it... It seems Sergey unintentionally "disguised" his real problem well. Cheers, Leen
Leendert Meyer wrote:
1. Did you read /etc/init.d/README and /etc/init.d/skeleton? Also 'man insserv' (the 'DESCRIPTION' section) has usefull info.
2. The glue is /etc/init.d/rc. It calls the S??xxx scripts with the 'start' parameter, and the K??xxx with the stop parameter.
Dear Leendert, Thank you very much, I should have read the README before posting, but haven't formed that habit yet ;)... It do clarify much, now I am in process of understanding the skeleton...
The initscripts need to be in /etc/init.d by convention (LSB I think). Also, when creating a new service, it might be a good idea to start from /etc/init.d/skeleton. You do not need all of it, see the init.d/ directory for plenty of examples. ;)
I thought that it would not be quite difficult, but it seems I need more basic knowledge.
It seems Sergey unintentionally "disguised" his real problem well.
The problem wasn't actually to make xmms autostart with the boot, I was just trying to do something "on my own" with that scripts and starting xmms was the first thing which came to my mind. Can you point me some good documentation for it? Thank you very much, Regards, -- Sergey Mkrtchyan Scientific Researcher Department of Molecular Physics, Faculty of Physics, Yerevan State University Tel: (374-10) 55-43-41 Fax: (374-10) 57-76-89
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Sunday 2006-05-21 at 00:17 +0500, Sergey Mkrtchyan wrote:
Can you point me some good documentation for it?
"man init.d" and the admin book, nowdays "reference" that you have in pdf and/or html format somewhere in the distro; chapter "The SuSE boot concept". - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEb3estTMYHG2NR9URAt8DAJ4xoxJfxl8QM18I7SsHlgeC10PAWwCfQnJP zHBcmbrrNJ8ziucybYbjjBQ= =5PGH -----END PGP SIGNATURE-----
On Saturday 20 May 2006 21:17, Sergey Mkrtchyan wrote:
Leendert Meyer wrote:
1. Did you read /etc/init.d/README and /etc/init.d/skeleton? Also 'man insserv' (the 'DESCRIPTION' section) has usefull info.
2. The glue is /etc/init.d/rc. It calls the S??xxx scripts with the 'start' parameter, and the K??xxx with the stop parameter.
Dear Leendert, Thank you very much, I should have read the README before posting, but haven't formed that habit yet ;)...
It wouldn't be a bad habit at all... ;P
It seems Sergey unintentionally "disguised" his real problem well.
The problem wasn't actually to make xmms autostart with the boot, I was just trying to do something "on my own" with that scripts and starting xmms was the first thing which came to my mind.
:) Hmm, xmms is not the easiest thing to start with, as it depends on X. And for which user should it run? Maybe better try to 'autorun' xmms from an Autostart directory as suggested in other messages in this thread. Why not start from the skeleton, change the start and stop sections to do something simple, like: echo "$(date +%FT%T%z): FOO started" >> /tmp/FOO.log and echo "$(date +%FT%T%z): FOO stopped" >> /tmp/FOO.log (log files normally would go to /var/log/, but since your playing, I think /tmp/ is better) Play a bit with the INIT INFO section, etc. and expand from there.
Can you point me some good documentation for it?
Carlos already provided you some docs. ;) Cheers, Leen
Leendert Meyer wrote:
Why not start from the skeleton, change the start and stop sections to do something simple, like: echo "$(date +%FT%T%z): FOO started" >> /tmp/FOO.log and echo "$(date +%FT%T%z): FOO stopped" >> /tmp/FOO.log
(log files normally would go to /var/log/, but since your playing, I think /tmp/ is better)
Dear Leendert, I was playing these days with it, understood a lot, but again there is some small problems I have. Here what I have done: In the skeleton I just changed the appropriate parts to _ |case "$1" in | start) | echo "$(date +%FT%T%z): FOO started" >> /tmp/FOO.log | /sbin/startproc $FOO_BIN | rc_status -v | ;; | stop) | echo "$(date +%FT%T%z): FOO stopped" >> /tmp/FOO.log | /sbin/killproc -TERM $FOO_BIN - If I leave the following part uncommented, and there is no FOO in my /usr/bin _ |FOO_BIN=/usr/sbin/FOO |test -x $FOO_BIN || { echo "$FOO_BIN not installed"; | if [ "$1" = "stop" ]; then exit 0; | else exit 5; fi; } | |# Check for existence of needed config file and read it |FOO_CONFIG=/etc/sysconfig/FOO |test -r $FOO_CONFIG || { echo "$FOO_CONFIG not existing"; | if [ "$1" = "stop" ]; then exit 0; | else exit 6; fi; } | |# Read config |. $FOO_CONFIG - after running insserv and chkconfig and restarting it gives, as expected, at booting /usr/sbin/FOO not installed If I comment all the part placed here(from FOO_BIN to $FOO_CONFIG), it gives the following in the dmesg startproc: Usage: startproc [-f] [+/-<prio>] [-s] [-u uid] [-g gid] [-v] [-l log_file|-q] /full/path/to/program failed Failed services in runlevel 3: try(<- my one) But with all that it creates FOO.log in my tmp folder, with correct information in it. And in this case I hadn't to change anything between BEGIN INIT INFO and END INIT INFO. Am I right? If I havent' became boring yet, could you help me, please with it. I am a newbie and got a very little experience with shell scripting, maybe I should leave this for a better times?
Can you point me some good documentation for it?
Carlos already provided you some docs. ;)
I read it, thanks Carlos for that ;) I am learning a lot, thank you very much! Regards, -- Sergey Mkrtchyan Scientific Researcher Department of Molecular Physics, Faculty of Physics, Yerevan State University Tel: (374-10) 55-43-41 Fax: (374-10) 57-76-89
On Monday 22 May 2006 10:18, Sergey Mkrtchyan wrote:
Leendert Meyer wrote:
Why not start from the skeleton, change the start and stop sections to do something simple, like: echo "$(date +%FT%T%z): FOO started" >> /tmp/FOO.log and echo "$(date +%FT%T%z): FOO stopped" >> /tmp/FOO.log
(log files normally would go to /var/log/, but since your playing, I think /tmp/ is better)
Dear Leendert, I was playing these days with it, understood a lot, but again there is some small problems I have.
Here what I have done: In the skeleton I just changed the appropriate parts to
Here's a extremely minimalistic 'skeleton', stripped from comments: ----<cut here>---- #!/bin/sh ### BEGIN INIT INFO # Provides: FOO # Required-Start: $syslog $remote_fs # Should-Start: $time ypbind sendmail # Required-Stop: $syslog $remote_fs # Should-Stop: $time ypbind sendmail # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: FOO XYZ daemon providing ZYX # Description: Start FOO to allow XY and provide YZ # continued on second line by '#<TAB>' # should contain enough info for the runlevel editor # to give admin some idea what this service does and # what it's needed for ... # (The Short-Description should already be a good hint.) ### END INIT INFO . /etc/rc.status rc_reset case "$1" in start) echo -n "Starting FOO " echo "$(date +%FT%T%z): FOO started" >> /tmp/FOO.log # false rc_status -v ;; stop) echo -n "Shutting down FOO " echo "$(date +%FT%T%z): FOO stopped" >> /tmp/FOO.log # false rc_status -v ;; restart) $0 stop $0 start rc_status ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac rc_exit ----<cut here>----
I am a newbie and got a very little experience with shell scripting,
Hmm, I assumed you know a bit of shell-script programming. However, if you're a programmer, you might learn it quickly (you know best if you could).
maybe I should leave this for a better times?
Well, you learning curve just got a bit steeper... ;) You might as well add 'man bash' to your RTFM list. But there are some shell-scripting tutorials on the net. However I can't recommend any, because I don't know any. ;) Here's a starting point: http://en.wikipedia.org/wiki/Bash (I like Wikipedia more and more...). There are some links at the bottom that might interest you. Cheers, Leen
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Monday 2006-05-22 at 11:01 +0200, Leendert Meyer wrote:
Well, you learning curve just got a bit steeper... ;) You might as well add 'man bash' to your RTFM list. But there are some shell-scripting tutorials on the net. However I can't recommend any, because I don't know any. ;)
There are also some howtos in the distro: Bash-Prog-Intro-HOWTO.gz Bash-Prompt-HOWTO.gz (plus the html version). There is also an "advanced" howto, but it is not included.
Here's a starting point: http://en.wikipedia.org/wiki/Bash (I like Wikipedia more and more...). There are some links at the bottom that might interest you.
Uau! :-)) - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEcYmLtTMYHG2NR9URAlfLAJ4o8GAI1HlPT0be8VmEtqoLdegICgCfYG+X 0AGMfJHfqSIYfpWeUGYrDbc= =1tRg -----END PGP SIGNATURE-----
Carlos E. R. wrote:
There are also some howtos in the distro:
Bash-Prog-Intro-HOWTO.gz Bash-Prompt-HOWTO.gz
(plus the html version). There is also an "advanced" howto, but it is not included.
Very sad, but seems they are absent in my one. there is one "docu" folder which contains RELEASE_NOTES.doc and rtf and folder "en" in which only two pdfs reference_en.pdf and startup_en.pdf. Regards, -- Sergey Mkrtchyan Scientific Researcher Department of Molecular Physics, Faculty of Physics, Yerevan State University Tel: (374-10) 55-43-41 Fax: (374-10) 57-76-89
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Wednesday 2006-05-24 at 01:47 +0500, Sergey Mkrtchyan wrote:
Carlos E. R. wrote:
There are also some howtos in the distro:
Bash-Prog-Intro-HOWTO.gz Bash-Prompt-HOWTO.gz
(plus the html version). There is also an "advanced" howto, but it is not included.
Very sad, but seems they are absent in my one.
The "howtos" have to be installed - as everything else. In 9.3, it is "howto-2005.3.6-2...rpm". In 10.1 it is howto-2006.3.27-3.nosrc.rpm (not in the dvd). - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEc4VQtTMYHG2NR9URAujhAJ40tFZrAqqwvyySPHCzH+885fFcNwCfWHXI lryszyp3bWM0UJRwoXER19A= =pinO -----END PGP SIGNATURE-----
Leendert Meyer wrote:
Here's a extremely minimalistic 'skeleton', stripped from comments:
----<cut here>---- #!/bin/sh ### BEGIN INIT INFO # Provides: FOO # Required-Start: $syslog $remote_fs # Should-Start: $time ypbind sendmail # Required-Stop: $syslog $remote_fs # Should-Stop: $time ypbind sendmail # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: FOO XYZ daemon providing ZYX # Description: Start FOO to allow XY and provide YZ # continued on second line by '#<TAB>' # should contain enough info for the runlevel editor # to give admin some idea what this service does and # what it's needed for ... # (The Short-Description should already be a good hint.) ### END INIT INFO . /etc/rc.status rc_reset case "$1" in start) echo -n "Starting FOO " echo "$(date +%FT%T%z): FOO started" >> /tmp/FOO.log # false rc_status -v ;; stop) echo -n "Shutting down FOO " echo "$(date +%FT%T%z): FOO stopped" >> /tmp/FOO.log # false rc_status -v ;; restart) $0 stop $0 start rc_status ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac rc_exit ----<cut here>----
After a little problems it worked! really extremely helpfull, thank you!
However, if you're a programmer, you might learn it quickly (you know best if you could).
Actually my major is Biophysics, and that is what I am doing now, but have been in programming not a little time, so I think it will not be difficult. My problem was that I couldn't find the appropriate documentation, but now seems that I have found some good books... reading them carefully now ;)
maybe I should leave this for a better times?
Well, you learning curve just got a bit steeper... ;) You might as well add 'man bash' to your RTFM list. But there are some shell-scripting tutorials on the net. However I can't recommend any, because I don't know any. ;)
Here's a starting point: http://en.wikipedia.org/wiki/Bash (I like Wikipedia more and more...). There are some links at the bottom that might interest you. Well, hope will be able to get to that curves' extremum (if there is one) :)
Thank you for the link...helped much Regards, -- Sergey Mkrtchyan Scientific Researcher Department of Molecular Physics, Faculty of Physics, Yerevan State University Tel: (374-10) 55-43-41 Fax: (374-10) 57-76-89
On Tuesday 23 May 2006 22:34, Sergey Mkrtchyan wrote:
Leendert Meyer wrote:
Here's a extremely minimalistic 'skeleton', stripped from comments: ... echo "$(date +%FT%T%z): FOO started" >> /tmp/FOO.log # false rc_status -v ... echo "$(date +%FT%T%z): FOO stopped" >> /tmp/FOO.log # false rc_status -v ... After a little problems it worked! really extremely helpfull, thank you!
Uncomment both 'false' statements to see something interesting during starting/stopping. ;)
maybe I should leave this for a better times?
Well, you learning curve just got a bit steeper... ;) You might as well add 'man bash' to your RTFM list. But there are some shell-scripting tutorials on the net. However I can't recommend any, because I don't know any. ;)
Here's a starting point: http://en.wikipedia.org/wiki/Bash (I like Wikipedia more and more...). There are some links at the bottom that might interest you.
Well, hope will be able to get to that curves' extremum (if there is one) :)
Indeed, if there is one... :P
Thank you for the link...helped much
Great! :) Cheers, Leen
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Saturday 2006-05-20 at 14:40 +0500, Sergey Mkrtchyan wrote: .... I'll just add a bit to the excellent answer by Leendert:
And next one is: I just want to add something(for example xmms)
That example will not work: services are started by "root" before you log in. That xmms needs you are logged in, and started by that user.
to start automaticaly in runlevel 5, so in my /etc/init.d/rc5.d directory I created symbolic link to /usr/bin/xmms executable file with a name like
If you create the link manually, it will not work, either. Not for long, in any case. Please read: man init.d Also, the "The SuSE boot concept" chapter in the SuSE admin book - paper or electronic. - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEbyaotTMYHG2NR9URAt0nAJ9NHcUuNWdq6vIhY+QSz9BjPx3CaACcCgw0 shsmPIA+aaj2m9bY2/uB+84= =bin8 -----END PGP SIGNATURE-----
On Saturday, May 20, 2006 @ 9:25 AM, Carlos Robinson wrote:
The Saturday 2006-05-20 at 14:40 +0500, Sergey Mkrtchyan wrote:
....
I'll just add a bit to the excellent answer by Leendert:
And next one is: I just want to add something(for example xmms)
That example will not work: services are started by "root" before you log in. That xmms needs you are logged in, and started by that user.
to start automaticaly in runlevel 5, so in my /etc/init.d/rc5.d directory I created symbolic link to /usr/bin/xmms executable file with a name like
If you create the link manually, it will not work, either. Not for long, in any case.
Please read:
man init.d
Also, the "The SuSE boot concept" chapter in the SuSE admin book - paper or electronic.
- -- Cheers, Carlos Robinson
Carlos: I haven't done any work on setting up new procedures in the rc system in a while, not since the dependency checking aspect was put in. I just took a look at .depend.start, which I take it is a file you have to edit in order to set up any dependencies between a new process and ones already existing. It looks pretty straightforward except for the "TARGETS =" statement in the beginning. Would you have to modify this as well as adding any dependencies down further in the script? I didn't see any explanation of what this statement was about in the README. Greg Wallace
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Saturday 2006-05-20 at 13:56 -0500, Greg Wallace wrote:
Carlos: I haven't done any work on setting up new procedures in the rc system in a while, not since the dependency checking aspect was put in. I just took a look at .depend.start, which I take it is a file you have to edit in order to set up any dependencies between a new process and ones already existing.
Don't! Simply let "insserv" do it for you. Or chkconfig, or Yast. See "man insserv" for info on those files.
It looks pretty straightforward except for the "TARGETS =" statement in the beginning. Would you have to modify this as well as adding any dependencies down further in the script? I didn't see any explanation of what this statement was about in the README.
Correct, the readme is older. The documentation about this crucial aspect was missing in 9.3, when they introduced it. I don't know about 10.x. - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEb3cXtTMYHG2NR9URAp5/AJ42f6Btbr5LXBlSQgSJJky9G0CH0QCcCQVv ud1SjSAdclvMR+Sm8X9+Kks= =Xlrc -----END PGP SIGNATURE-----
On Saturday, May 20, 2006 @ 3:08 PM, Carlos Robinson wrote:
The Saturday 2006-05-20 at 13:56 -0500, Greg Wallace wrote:
Carlos: I haven't done any work on setting up new procedures in the rc system in a while, not since the dependency checking aspect was put in. I just took a look at .depend.start, which I take it is a file you have to edit in order to set up any dependencies between a new process and ones already existing.
Don't! Simply let "insserv" do it for you. Or chkconfig, or Yast. See "man insserv" for info on those files.
It looks pretty straightforward except for the "TARGETS =" statement in the beginning. Would you have to modify this as well as adding any dependencies down further in the script? I didn't see any explanation of what this statement was about in the README.
Correct, the readme is older. The documentation about this crucial aspect was missing in 9.3, when they introduced it. I don't know about 10.x.
- -- Cheers, Carlos Robinson
Thanks for the info. Carlos. So, if I wanted to set up a new startup procedure, would this be the steps? 1) Create an init.d script based on skeleton 2) Run innserv against the script 3) Go to runlevel editor and enable the script Greg Wallace
On Sat, 2006-05-20 at 15:24 -0500, Greg Wallace wrote:
On Saturday, May 20, 2006 @ 3:08 PM, Carlos Robinson wrote:
Thanks for the info. Carlos. So, if I wanted to set up a new startup procedure, would this be the steps?
1) Create an init.d script based on skeleton 2) Run innserv against the script 3) Go to runlevel editor and enable the script
Greg Wallace
2 and three do the same thing. Another thing to pay attention to in the startup script are the: # Required-Start: $syslog $remote_fs # Should-Start: $time ypbind sendmail # Required-Stop: $syslog $remote_fs # Should-Stop: $time ypbind sendmail # Default-Start: 3 5 # Default-Stop: 0 1 2 6 lines as they determine the start order of the scripts, the S# and the K# assigned to the links in the RC#.d dirs. -- Ken Schneider UNIX since 1989, linux since 1994, SuSE since 1998
On 5/20/06, Ken Schneider
2 and three do the same thing. Another thing to pay attention to in the startup script are the:
whew -- good! I saw the question, and thought "oh, sh&% -- I guess I didn't understand!" ;-) Basically, I guess innserv is called by chkconfig/runlevel editor .... Peter
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Saturday 2006-05-20 at 15:38 -0500, Peter Van Lone wrote:
Basically, I guess innserv is called by chkconfig/runlevel editor ....
Yes. And it is far more confortable to use "chkconfig service on|off" than innserv whatever. - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEb54StTMYHG2NR9URAubdAKCB4ior3NPdDbIVaiF4wJNejHNbAwCfcW3g chCsMFkAtpvXaXDS9HkRUPc= =ZgL3 -----END PGP SIGNATURE-----
Carlos E. R. wrote:
Yes. And it is far more confortable to use "chkconfig service on|off" than innserv whatever.
Huh? More _comfortable_? How do you figure that Carlos? /Per Jessen, Zürich who would always use insserv ...
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Sunday 2006-05-21 at 08:42 +0200, Per Jessen wrote:
Yes. And it is far more confortable to use "chkconfig service on|off" than innserv whatever.
Huh? More _comfortable_? How do you figure that Carlos?
Easier to remember, then, no switches: nimrodel:~ # chkconfig nfs nfs off Now I only need to add "on" to the command line to set it on: nimrodel:~ # chkconfig nfs on Also, "chkconfig" with no parameters lists all services (on,off,xinetd). And a few more things. But insserv does not have a check option. And you may have to specify the path. - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEcEdVtTMYHG2NR9URAuvbAJoDNFqa6Tpf/KOx6jBfVgQhTSIv0QCeOyX6 LuunH8h/FkwhDX0rakVXgOs= =BUQv -----END PGP SIGNATURE-----
On Saturday, May 20, 2006 @ 3:34 PM, Ken Schneider wrote:
On Sat, 2006-05-20 at 15:24 -0500, Greg Wallace wrote:
On Saturday, May 20, 2006 @ 3:08 PM, Carlos Robinson wrote:
Thanks for the info. Carlos. So, if I wanted to set up a new startup procedure, would this be the steps?
1) Create an init.d script based on skeleton 2) Run innserv against the script 3) Go to runlevel editor and enable the script
Greg Wallace
2 and three do the same thing. Another thing to pay attention to in the startup script are the:
# Required-Start: $syslog $remote_fs # Should-Start: $time ypbind sendmail # Required-Stop: $syslog $remote_fs # Should-Stop: $time ypbind sendmail # Default-Start: 3 5 # Default-Stop: 0 1 2 6
lines as they determine the start order of the scripts, the S# and the K# assigned to the links in the RC#.d dirs.
-- Ken Schneider UNIX since 1989, linux since 1994, SuSE since 1998
So, for example, does Default-Start 3 5 say to start it in runlevels 3 and 5? And as far as predecessors, would you not set that up by adding a line into .depend.start (and .depend.stop for the kills)? Greg Wallace
On 5/20/06, Greg Wallace
So, for example, does Default-Start 3 5 say to start it in runlevels 3 and 5?
yes, that -- when you have that in the init section, and then run chconfig/runlevel editor, it creates (via innserv I think) the K and S links to the script in the rc3.d and rc5.d directories.
And as far as predecessors, would you not set that up by adding a line into .depend.start (and .depend.stop for the kills)?
From what I have seen so far in the docs (I'm only partway through it all) it appears as though the .depend.start and .depend.stop files are modified automagically again, as a result of reading the init section "required start/stop and should start/stop" of all the scripts in /etc/init.d
Peter
On Saturday, May 20, 2006 @ 4:41 PM, Peter Van Lone wrote:
On 5/20/06, Greg Wallace
wrote:
So, for example, does Default-Start 3 5 say to start it in runlevels 3 and 5?
yes, that -- when you have that in the init section, and then run chconfig/runlevel editor, it creates (via innserv I think) the K and S links to the script in the rc3.d and rc5.d directories.
And as far as predecessors, would you not set that up by adding a line into .depend.start (and .depend.stop for the kills)?
From what I have seen so far in the docs (I'm only partway through it all) it appears as though the .depend.start and .depend.stop files are modified automagically again, as a result of reading the init section "required start/stop and should start/stop" of all the scripts in /etc/init.d
Peter
In init.d scripts I looked at, Required-Start, Required-Stop, etc. are all commented, but maybe they are still read when you use the run level editor to set them up. Then again, maybe you leave them uncommented when you set up the script and then, when you add them via the run level editor, it comments them out as part of its setup process? Greg Wallace
On 5/20/06, Greg Wallace
In init.d scripts I looked at, Required-Start, Required-Stop, etc. are all commented, but maybe they are still read when you use the run level editor to set them up. Then again, maybe you leave them uncommented when you set up the script and then, when you add them via the run level editor, it comments them out as part of its setup process?
yes, that caused me concern, too ... but it is as you said. Chkconfig or the runlevel editor read them, despite that they *appear* to be commented. At least, that is how it has worked on the 2 services I have now setup for testing. Peter
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Saturday 2006-05-20 at 18:31 -0500, Peter Van Lone wrote:
yes, that caused me concern, too ... but it is as you said. Chkconfig or the runlevel editor read them, despite that they *appear* to be commented. At least, that is how it has worked on the 2 services I have now setup for testing.
Don't worry. They are commented because, as the scripts are executables, those comments are ignored. But they are nevertheless interpreted by innserv. You only need to use the correct format (the "begin init info" line till "end...". The skeleton file has a lot of info. - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEb7FBtTMYHG2NR9URAvGFAJ428KATBJbuE9iG8Ni1azjy9OJcowCfd/2E +EI4z5HfGZ9M4Czj28KgLyU= =Mf90 -----END PGP SIGNATURE-----
On Saturday, May 20, 2006 @ 7:16 PM, Carlos Robinson wrote:
The Saturday 2006-05-20 at 18:31 -0500, Peter Van Lone wrote:
yes, that caused me concern, too ... but it is as you said. Chkconfig or the runlevel editor read them, despite that they *appear* to be commented. At least, that is how it has worked on the 2 services I have now setup for testing.
Don't worry. They are commented because, as the scripts are executables, those comments are ignored. But they are nevertheless interpreted by innserv.
You only need to use the correct format (the "begin init info" line till "end...".
The skeleton file has a lot of info.
- -- Cheers, Carlos Robinson
Ok, now it's making sense. So, you set up your new script using the skeleton and modify the appropriate lines in what appears as commented lines at the beginning of the script. Then, when you activate it in the runlevel editor, those lines get interpreted and the appropriate dependencies are set up at the same time it builds the K... and S... scipts. Do I have this right now? Greg Wallace
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Saturday 2006-05-20 at 19:58 -0500, Greg Wallace wrote:
Ok, now it's making sense. So, you set up your new script using the skeleton and modify the appropriate lines in what appears as commented lines at the beginning of the script. Then, when you activate it in the runlevel editor, those lines get interpreted and the appropriate dependencies are set up at the same time it builds the K... and S... scipts. Do I have this right now?
¡Yes! :-) - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEcEeUtTMYHG2NR9URAiNgAJ4gYWWAhhZrBK/jD4U7xFOTbRNMyACfVgiG VctmGZjMsGa0KnT14EiY1VY= =5pn8 -----END PGP SIGNATURE-----
On Sat, 2006-05-20 at 18:31 -0500, Peter Van Lone wrote:
On 5/20/06, Greg Wallace
wrote: In init.d scripts I looked at, Required-Start, Required-Stop, etc. are all commented, but maybe they are still read when you use the run level editor to set them up. Then again, maybe you leave them uncommented when you set up the script and then, when you add them via the run level editor, it comments them out as part of its setup process?
yes, that caused me concern, too ... but it is as you said. Chkconfig or the runlevel editor read them, despite that they *appear* to be commented. At least, that is how it has worked on the 2 services I have now setup for testing.
Peter
That just happens to be the format of the file, the lines are read at config time anyway. -- Ken Schneider UNIX since 1989, linux since 1994, SuSE since 1998
On 5/20/06, Greg Wallace
So, for example, does Default-Start 3 5 say to start it in runlevels 3 and 5? And as far as predecessors, would you not set that up by adding a line into .depend.start (and .depend.stop for the kills)?
I found some info about ".depend.start" in man init.d: There are two kinds of symbolic link: start links, which are called when entering a run level, and stop links, which are called when leav‐ ing a run level. Note that each service in the run levels 2, 3, 4, and 5 consists of a start and a stop link. Within SuSE boot concept a dif‐ ferential link scheme is used to be able to change a runlevel in com‐ parision with the former level. If parallel executing of the boot scripts is enabled (see /etc/syscon‐ fig/boot variable RUN_PARALLEL) then both master scripts uses the pro‐ gram startpar(8) which starts or stops multiple services in parallel. Startpar(8) will look for the files /etc/init.d/.depend.boot, /etc/init.d/.depend.start, and /etc/init.d/.depend.stop to get the dependencies for each service. The files will be written, beside the symbolic links in the boot and runlevel directories, by the program insserv(8). To avoid redundant starts when changing run levels, only those services are started which have no start link in the previous run level. And to avoid redundant stops when changing run levels, only those services are stopped which have no start link in the current level. To control this behaviour, the names of the scripts are added on the names of the start and stop links.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Saturday 2006-05-20 at 16:26 -0500, Greg Wallace wrote:
So, for example, does Default-Start 3 5 say to start it in runlevels 3 and 5? And as far as predecessors, would you not set that up by adding a line into .depend.start (and .depend.stop for the kills)?
Leave the handling of the "depend" files to insserv: they are not to be touched by human hands :-P - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFEb53EtTMYHG2NR9URAjLVAJsEA29ixkuUFZNoStcS5H8kWg21WwCfWzs2 Gj2s6JkJts7DRKf0BP1iiBs= =op4w -----END PGP SIGNATURE-----
On Sat, 2006-05-20 at 16:26 -0500, Greg Wallace wrote:
On Saturday, May 20, 2006 @ 3:34 PM, Ken Schneider wrote:
# Required-Start: $syslog $remote_fs # Should-Start: $time ypbind sendmail # Required-Stop: $syslog $remote_fs # Should-Stop: $time ypbind sendmail # Default-Start: 3 5 # Default-Stop: 0 1 2 6
lines as they determine the start order of the scripts, the S# and the K# assigned to the links in the RC#.d dirs.
So, for example, does Default-Start 3 5 say to start it in runlevels 3 and 5? And as far as predecessors, would you not set that up by adding a line into .depend.start (and .depend.stop for the kills)?
Greg Wallace
As Carlos has pointed out don't bother with those files. The Default-Start 3 5 does mean run the script when entering run level 3 or 5. So if you start the system in run level 2 the script would not run. Add your required predecessors to the # Required-Start: line. -- Ken Schneider UNIX since 1989, linux since 1994, SuSE since 1998
participants (7)
-
Carlos E. R.
-
Greg Wallace
-
Ken Schneider
-
Leendert Meyer
-
Per Jessen
-
Peter Van Lone
-
Sergey Mkrtchyan