I need to disable a service in RHEL, before upgrading it. Stopping it does not do the trick, because it uses the respawn stanza , which causes it to start immediately after I stop it. The method in https://askubuntu.com/questions/19320/how-to-enable-or-disable-services namely using .override files is not supported in the version of upstart I have (0.6.7 and I cannot upgrade).

I thought of commenting out the respawn stanza before stopping the service, and removing the comment after the upgrade is complete. Is there any other/better idea?


As a workaround until upstart is upgraded to 1.3 where the .override files are supported, it is possible to comment out the respawn stanza. It can also be automated, .e.g. as part of an rpm script, using the following sed commands:

# to disable:
sed -i -e 's/^respawn/#respawn/' /etc/init/my_svc.conf

# to enable:
sed -i -e 's/#respawn/respawn/' /etc/init/my_svc.conf    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.