This repository has been archived on 2023-04-13. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
CloudBot/restartcloudbot.sh
2017-02-22 23:45:52 +01:00

23 lines
361 B
Bash
Executable file

#!/bin/bash
cd $(dirname $0)
(
PIDS=""
for i in $(ps -awx | grep -i [c]loudbot | sed "s/^\s*//" | cut -d" " -f1); do
if [ $i != $$ ]; then
PIDS="$i $PIDS"
fi
done
if [ ! -z "$PIDS" ]; then
kill $PIDS
sleep 10
kill -9 $PIDS >/dev/null 2>&1
fi
while true
do
sudo -u cloudbot ./cloudbot.py 2>&1 | logger -s -t $(basename $0)
sleep 10
done
) &
disown $!