#!/bin/bash
# config
basedir="$HOME/Sick-Beard"
execfile="SickBeard.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 -d

Add a code snippet to your website: www.paste.org