#!/bin/bash
# config
basedir="$HOME/CouchPotato"
execfile="CouchPotato.py"
# pre
pid=$(pgrep -f $execfile)
cd "$basedir"
# kill
kill $pid
c=0
while ps -p $pid >/dev/null; do
if [ $[c++] -eq 6 ]; then
break
fi
sleep 5
done
if ps -p $pid; then
kill -9 $pid
fi
sleep 5
git pull
python $execfile </dev/null >/dev/null 2>/dev/null &
disown
Add a code snippet to your website: www.paste.org