could use some help with my init.d script....
hello all... I'm new to this whole daemon thing.. trying to feel my way through. If someone could point me in the right direction, I'd be much appreciative.
I need to start my server program when the machine boots.. I figured it would need to startup at run level 3 & be started at level 4 & 5... the priority is low, so I've made links to this script in rc3, 4, &5.d as S99mlserver and in rc0,1,&2.d as K8mlserver. The script is /etc/init.d/mlserver and looks like this: Code:
#!/bin/bash and help would be great.. thanks. |
the S99 is relative to when it starts, so I guess you answered that yourself, the consideration is when do you want it to start in the sequence, maybe considering networking, firewall, etc. they don't need to be a unique number.
[root@www init.d]# chkconfig --list scriptname will show you what's setup [root@www init.d]# chkconfig --list squid squid 0:off 1:off 2:off 3:on 4:on 5:on 6:off if it's links are not in the runlevels I can do [root@www init.d]# chkconfig --add squid [root@www init.d]# grep chkconfig squid # chkconfig: - 90 25 the script contains the settings for chkconfig to use. so the links will be created on this one the runlevels are set in the script as well [root@www init.d]# grep chkconfig syslog # chkconfig: 2345 12 88 you can use chkconfig to set one up like this... some examples.. [root@www init.d]# chkconfig --list squid squid 0:off 1:off 2:off 3:on 4:on 5:on 6:off [root@www init.d]# chkconfig --level 2345 squid on [root@www init.d]# chkconfig --list squid squid 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@www init.d]# chkconfig --level 2 squid off [root@www init.d]# chkconfig --list squid squid 0:off 1:off 2:off 3:on 4:on 5:on 6:off |
Does the kill -9 processname actually work? Depending on how your scripts are start up there should be helper functions around for starting and stopping daemons. Usually something like startproc and stopproc. They usually create a file with the pid of the daemon in /var/run. This pid is used to kill the daemon properly. One thing you shouldn't forget is that if you don't shut down properly the pid file won't get removed. So if you haven't setup your scripts properly to clear these files then your daemon would probably not start on the next boot.
But you should look at the other scripts there should be plenty of examples of how it's done. |
thanks guys... that was what I needed. :)
|
All times are GMT -5. The time now is 06:17 AM. |