The is_script_stuck Script

Valid for versions 82 through the latest version

Version:

82

Last modified: May 13, 2020


Looking for this interface?
Note:

Your hosting provider can enable or disable this interface for resellers in WHM's Edit Reseller Nameservers and Privileges interface (WHM >> Home >> Resellers >> Edit Reseller Nameservers and Privileges).

Overview

In some rare cases, a long process may hang indefinitely and be difficult for system administrators to detect. The /usr/local/cpanel/bin/is_script_stuck script checks how long a script’s current PID has run, and can notify a WHM user or kill the process.

For example, if you experience problems with hung backup processes, you could use this script in a cron job to monitor backup processes.

Run the script

To run this script on the command line, use the following format:

/usr/local/cpanel/bin/is_script_stuck [options]

Options

You can use the following options with this script:

  • --script — The absolute path to the script that you wish to check.

    Note:
    This option is required, unless you instead use the –help option.

  • time — The amount of time that the specified script can run before the /usr/local/cpanel/bin/is_script_stuck script determines that it is stuck.
    You can append one of the following units of measure:

    • d — Days.
    • h — Hours.
    • m — Minutes.
    • s — Seconds.

    If you do not append a unit of measure, the script treats this value as a number of seconds. For example, specify --time=60 for 60 seconds, or --time=4d for four days.

    Note:
    This option is required, unless you instead use the –help option.

  • --notify — The WHM username to which you wish to send a notification of the script’s results.

  • --kill — Use this option if you want the script to stop (kill) the specified script if it runs longer than the specified time.

  • --help — Print help information for this script.

Additional Documentation