This was recently answered in another thread <Quote>
Re: [CentOS] best way to start and shutdown programs in CentOS? On 24 November 2010 14:20, killscript <killscr...@gmail.com> wrote: > Les Mikesell wrote: >> The RedHat/Centos way of doing things is to have init scripts in >> /etc/rc.d/init.d that take at least start, stop, and restart as arguments for >> each program that should start automatically. Then for the runlevels where >> you >> want them to start you have a symlink where the name starts with S and the >> rest >> is a number to make it sort alphabetically into the order that things should >> start in /etc/rc?.d (where the ? is the runlevel). Likewise add links >> starting >> with 'K' in the levels where the process should be stopped. There is a >> convention for comments in the scripts so that 'checkconfig program on' can >> make >> the links for you. Look through some of the other scripts to see how they >> work. > > Sorry for the stupid question here, but does the /etc/initd./scriptname > file "know" about these symlinks because of a particular comment in there? Copied from the man file for chkconfig: RUNLEVEL FILES Each service which should be manageable by chkconfig needs two or more commented lines added to its init.d script. The first line tells chkconfig what runlevels the service should be started in by default, as well as the start and stop priority levels. If the service should not, by default, be started in any runlevels, a - should be used in place of the runlevels list. The sec- ond line contains a description for the service, and may be extended across multiple lines with backslash continuation. For example, random.init has these three lines: # chkconfig: 2345 20 80 # description: Saves and restores system entropy pool for \ # higher quality random number generation. This says that the random script should be started in levels 2, 3, 4, and 5, that its start priority should be 20, and that its stop priority should be 80. You should be able to figure out what the description says; the \ causes the line to be continued. The extra space in front of the line is ignored. Basically, create your file by taking one of the files as a sample and place it in /etc/init.d. For example, I've copied /etc/init.d/vncserver to /etc/init.d/sample and ran [r...@hakan init.d]# chkconfig --add sample [r...@hakan init.d]# chkconfig --list|grep sample sample 0:off 1:off 2:off 3:off 4:off 5:off 6:off Now my sample is there but won't run at all but it's all there. [r...@hakan init.d]# chkconfig sample on [r...@hakan init.d]# chkconfig --list|grep sample sample 0:off 1:off 2:on 3:on 4:on 5:on 6:off Now it's on for all of the levels in the comment included in the file. Nevertheless, I could have overriden that with the ckconfig --level <levels> <name> on command options to run on other levels. [r...@hakan etc]# find rc* -iname *sample*|sort rc.d/init.d/sample rc.d/rc0.d/K35sample rc.d/rc1.d/K35sample rc.d/rc2.d/S91sample rc.d/rc3.d/S91sample rc.d/rc4.d/S91sample rc.d/rc5.d/S91sample rc.d/rc6.d/K35sample and the file comment looks like below which matches the above, startup priority is 91, kill priority is 35. It will run on all normal levels since it's not defined, excluding 1 (single user), 0 (shutdown) and 6 (reboot). # chkconfig: - 91 35 I better remove this sample from my startup :) -- Hakan (m1fcj) - http://www.hititgunesi.org _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos ------Original Message------ From: Johan Scheepers Sender: centos-boun...@centos.org To: centos ReplyTo: CentOS mailing list Subject: [CentOS] Add application to start at booting Sent: Nov 25, 2010 10:45 AM Good day, Please, How/where can I add an application to start at boot up. Don't seem to find it in options available Thanks Johan _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos Sent from my Verizon Wireless BlackBerry _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos