You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
753 B

  1. #!/bin/sh
  2. PID="log/supervisord.pid"
  3. CONF="etc/supervisord.conf"
  4. EXEPATH='/usr/bin/gogs_start'
  5. if [ ! -f $EXEPATH ]; then
  6. gogs_scripts_path=$(cd `dirname $0`; pwd)
  7. echo $gogs_scripts_path
  8. sudo ln -s $gogs_scripts_path'/start.sh' /usr/bin/gogs_start
  9. fi
  10. LOGDIR="log"
  11. if [ ! -d $LOGDIR ]; then
  12. mkdir $LOGDIR
  13. fi
  14. stop() {
  15. if [ -f $PID ]; then
  16. kill `cat -- $PID`
  17. rm -f -- $PID
  18. echo "stopped"
  19. fi
  20. }
  21. start() {
  22. echo "starting"
  23. if [ ! -f $PID ]; then
  24. supervisord -c $CONF
  25. echo "started"
  26. fi
  27. }
  28. case "$1" in
  29. start)
  30. start
  31. ;;
  32. stop)
  33. stop
  34. ;;
  35. restart)
  36. stop
  37. start
  38. ;;
  39. *)
  40. echo "Usage: $0 {start|stop|restart}"
  41. esac