This article focuses on a handy script for terminating stuck processes on Linux Systems.
We are operating a big test automation system running mainly on Linux. From time to time, some Selenium processes get stuck and stop all test automation with absolutely no reason. Therefore, our Test Automation System becomes corrupted and does not run for a whole night.
To solve this problem, my team wrote a Linux Bash script; Process Killer. This script is scheduled and starts to search, find, and kill the processes running longer than expected. For example; it terminates a Selenium process which continues more than 30 minutes.
The Process Killer script is designed to search any stuck process at defined time intervals with extensive logging capabilities. Search action is based on two defined variables:
KILLTIME. According to the defined values of these two variables, the script understands if the process time takes too long or not. For example; a defined process to kill is Selenium and the maximum duration is 30 minutes. If a Selenium process continues for longer than 30 minutes, the script terminates it.
Process Killer Project can be downloaded from GitHub. Let me know what you think!