Created
May 10, 2017 21:00
-
-
Save schuyler1d/0e5b01253692b3b10a9845a3e31870b9 to your computer and use it in GitHub Desktop.
delete files whose processes are not running but blocked by halockrun
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
crontab -l |egrep '^[0-9]+ [0-9]+' |egrep -o '\-n [a-z_/.]+ [a-z_/.]+' |while read -a line; do if [ -n "$(ps -ef|grep ${line[2]}|grep -v grep)" ] ;then echo "process ${line[2]} running"; else rm ${line[1]}; fi ;done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment