Over a million developers have joined DZone.

Process-Killer Script

DZone's Guide to

Process-Killer Script

DZone user Iffet Kurukose showcases a tool she developed with her team to kill automated test processes that run for too long.

· DevOps Zone ·
Free Resource

Download the blueprint that can take a company of any maturity level all the way up to enterprise-scale continuous delivery using a combination of Automic Release Automation, Automic’s 20+ years of business automation experience, and the proven tools and practices the company is already leveraging.

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:  PROCESS_TO_KILL  and 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!

Download the ‘Practical Blueprint to Continuous Delivery’ to learn how Automic Release Automation can help you begin or continue your company’s digital transformation.

linux ,os ,bash ,shell script ,test automation ,continuos integration

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}