Reputation: 13
I know this an old question but I am having a tough time in understanding the linux runlevels w.r.t gracefully stopping and starting a service. For suppose consider myscript
service is configured to auto-start after a system shutdown/reboot.
Below is the output of chkconfig command (RHEL 6.5x):
[testfolk@jomohost ~]$ sudo chkconfig --list|grep myscript
myscript 0:off 1:off 2:on 3:on 4:off 5:on 6:off
I understand that myscript
service auto-starts on system startup. But what takes care of it's gracefull stop/shutdown task. What if myscript
is a delicate service and need to be stopped at any cost before any reboot/shutdown or the application gets corrupted. Is taken care of by default ?
Can I configure it something like below to do a graceful auto stop:
[testfolk@jomohost ~]$ sudo chkconfig --list|grep myscript
myscript 0:on 1:off 2:on 3:on 4:off 5:on 6:on
My assumption of above configuration is the myscript service gets auto stopped on invoking init 6 or init 0. Is this a valid config, I can be completely wrong, please advise. I searched as many articles as possible but all of them were talking about auto-start of a service after a reboot or shutdown but not auto-stop. I am not sure if I am understanding this whole thing correctly, pls help if you have any info!
Thanks in advance for your time!
Upvotes: 0
Views: 299