diff options
Diffstat (limited to 'pbot-ng_fixer')
-rwxr-xr-x | pbot-ng_fixer | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pbot-ng_fixer b/pbot-ng_fixer index b7ae075..b040727 100755 --- a/pbot-ng_fixer +++ b/pbot-ng_fixer @@ -8,11 +8,16 @@ do # pbot is dead. if [[ -z $(find logs/ -iname 'raw.log' -mmin -30) ]] then + echo "[pbot-ng_fixer]: restarting pbot due to inactivity" + # Kill all pbot processes - while read -r line + while read -r pid do # If it's not the pid of this process then kill it. - [[ "${line}" != "$$" ]] && kill "${line}" &>/dev/null + [[ "${pid}" != "$$" ]] || continue + + echo "[pbot-ng_fixer]: killing '$(ps -p ${pid} -o comm=)'(${pid})" + kill "${pid}" &>/dev/null done < <( pgrep -u pbot ) # Start pbot |