Custom service script does not execute on system shutdown

Solution Verified - Updated -


Red Hat Enterprise Linux 5


  • Created new service scripts to execute at boot and shutdown. Added to system with 'checkcfg --add' with no errors.

  • Boot portion works but shutdown does not even execute at all.

  • Running the init.d script, and boot/shutdown scripts manually works fine. It's just that chkconfig does not.


  • A lock file is required for SysVInit scripts.

  • Add touch /var/lock/subsys/<service> to the start() function.

  • Add rm -f /var/lock/subsys/<service> to the stop() function.

Root Cause

  • The SysVInit system makes the presumption that any daemon that requires a shutdown mechanism, beyond being terminated via a signal, maintains a lock file.

Diagnostic Steps

  • This document from the Fedora project explains how to create custom SysVInit service scripts.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.