#!/bin/sh mydir=$(readlink -f $0) mydir=$(dirname "$mydir") python3 -V > /dev/null 2>&1 && python3="python3" if [ -z "$python3" ]; then python3.4 -V > /dev/null 2>&1 && python3="python3.4" if [ -z "$python3" ]; then echo "Did not find neither python3 nor python3.4 in your path :-(" exit 1 fi fi if [ ! -r "${mydir}/bot.cfg" ]; then echo "'bot.cfg' is missing. Have you copied 'bot.cfg.example'?" exit 2 fi case $1 in start) [ ! -d "${mydir}/logs" ] && mkdir "${mydir}/logs" $python3 "${mydir}/willie/willie.py" -c "${mydir}/bot.cfg" --fork ;; stop) $python3 "${mydir}/willie/willie.py" -c "${mydir}/bot.cfg" --quit ;; restart) "$0" stop sleep 2 "$0" start ;; reload) echo "Not supported by script. Issue '!reload ffpb' in a query to reload the ffpb module." exit 2 ;; *) echo "Unknown command. Please give 'start', 'stop' or 'restart'." exit 1 ;; esac