One of my shell script was overlapping which resulted in 100% memory usage. So, I have written a validation that checks if the same shell script is running or not. If it’s not running it will continue to process further, otherwise exit. Below is the code snippet.
#!/bin/sh[ "$(pidof -x $(basename $0))" != $$ ] && exit## process further