summaryrefslogtreecommitdiff
path: root/pbot-ng_fixer
blob: 078f58780a2521e86637f1eb30a8515ee2480b5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/bash

while true
do
    sleep 30m

    # If nothing has been written to the log for 30 minutes then we assume
    # pbot-ng is dead.
    if [[ -z $(find logs/ -iname 'raw.log' -mmin -30) ]]
    then
        # Kill all pbot-ng processes
        while read -r line
        do
            # If it's not the pid of this process then kill it.
            [[ "${line}" != "$$" ]] && kill "${line}" &>/dev/null
        done < <( pgrep -u pbot-ng )

        # Start pbot-ng
        cd /home/pbot-ng

        ./envbot &
        ./labs_change_detector &
    fi
done