bot.sh 793 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. mydir=$(readlink -f $0)
  3. mydir=$(dirname "$mydir")
  4. python3 -V > /dev/null 2>&1 && python3="python3"
  5. if [ -z "$python3" ]; then
  6. python3.4 -V > /dev/null 2>&1 && python3="python3.4"
  7. if [ -z "$python3" ]; then
  8. echo "Did not find neither python3 nor python3.4 in your path :-("
  9. exit 1
  10. fi
  11. fi
  12. case $1 in
  13. start)
  14. [ ! -d "${mydir}/logs" ] && mkdir "${mydir}/logs"
  15. $python3 "${mydir}/willie/willie.py" -c "${mydir}/ffpb.cfg" --fork
  16. ;;
  17. stop)
  18. $python3 "${mydir}/willie/willie.py" -c "${mydir}/ffpb.cfg" --quit
  19. ;;
  20. restart)
  21. "$0" stop
  22. sleep 2
  23. "$0" start
  24. ;;
  25. reload)
  26. echo "Not supported by script. Issue '!reload ffpb' in a query to reload the ffpb module."
  27. exit 2
  28. ;;
  29. *)
  30. echo "Unknown command. Please give 'start', 'stop' or 'restart'."
  31. exit 1
  32. ;;
  33. esac