Advertisement
Guest User

asdasd

a guest
Feb 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.34 KB | None | 0 0
  1. LIMIT="1800" ; ps aux | grep cli.php | awk '{print $2}' | while read PID ; do UPTIME=$(awk -v ticks="$(getconf CLK_TCK)" 'NR==1 { now=$1; next } { print int(now - ($22/ticks)) }' /proc/uptime /proc/$PID/stat 2>/dev/null) ; if [ ! -z "$UPTIME" ] && [ "$UPTIME" -ge "$LIMIT" ] ; then echo "$PID is now killing" ; kill -9 $PID ; fi ; done > /dev/null 2>&1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement