Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save schuyler1d/0e5b01253692b3b10a9845a3e31870b9 to your computer and use it in GitHub Desktop.
Save schuyler1d/0e5b01253692b3b10a9845a3e31870b9 to your computer and use it in GitHub Desktop.
delete files whose processes are not running but blocked by halockrun
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