is_script_stuck script to kill or notify in cPanel

In some rare cases, a long process may hang indefinitely and be difficult for system administrators to detect. The /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 /bin/is_script_stuck script

To run the /bin/is_script_stuck script on the command line, use the following format:

/bin/is_script_stuck [options]

You can use the following options with this script:

Options
Description
Example
--script The absolute path to the script that you wish to check.

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

--script=bin/backup
--time The amount of time that the specified script can run before the /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.

--time=24h
--notify The WHM username to which you wish to send a notification of the script’s results. --notify=root
--kill Use this option if you want the script to stop (kill) the specified script if it runs longer than the specified time. --kill
--help Print help information for the /bin/is_script_stuck script. --help

Leave a comment