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

Do you need to strengthen the security of the mobile apps you build? Discover more than 50 secure mobile development coding practices to make your apps more secure.

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!

Check out tips for blazing the way from agile to DevSecOps with security built into your mobile app toolchain.

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 }}