4
0

bot.sh 643 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. mydir=$(readlink -f $0)
  3. mydir=$(dirname "$mydir")
  4. if [ ! -r "${mydir}/bot.cfg" ]; then
  5. echo "'bot.cfg' is missing. Have you copied 'bot.cfg.example'?"
  6. exit 2
  7. fi
  8. case $1 in
  9. start)
  10. [ ! -d "${mydir}/logs" ] && mkdir "${mydir}/logs"
  11. "${mydir}/willie/willie.py" -c "${mydir}/bot.cfg" --fork
  12. ;;
  13. stop)
  14. "${mydir}/willie/willie.py" -c "${mydir}/bot.cfg" --quit
  15. ;;
  16. restart)
  17. "$0" stop
  18. sleep 2
  19. "$0" start
  20. ;;
  21. reload)
  22. echo "Not supported by script. Issue '!reload ffpb' in a query to reload the ffpb module."
  23. exit 2
  24. ;;
  25. *)
  26. echo "Unknown command. Please give 'start', 'stop' or 'restart'."
  27. exit 1
  28. ;;
  29. esac