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.

gitea 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/sh
  2. #
  3. # /etc/rc.d/init.d/gitea
  4. #
  5. # Runs the Gogs Go Git Service.
  6. #
  7. #
  8. # chkconfig: - 85 15
  9. #
  10. ### BEGIN INIT INFO
  11. # Provides: gitea
  12. # Required-Start: $remote_fs $syslog
  13. # Required-Stop: $remote_fs $syslog
  14. # Default-Start: 2 3 4 5
  15. # Default-Stop: 0 1 6
  16. # Short-Description: Start gitea at boot time.
  17. # Description: Control gitea.
  18. ### END INIT INFO
  19. # Source function library.
  20. . /etc/init.d/functions
  21. # Default values
  22. NAME=gitea
  23. GITEA_HOME=/home/git/gitea
  24. GITEA_PATH=${GITEA_HOME}/$NAME
  25. GITEA_USER=git
  26. SERVICENAME="Gogs Go Git Service"
  27. LOCKFILE=/var/lock/subsys/gitea
  28. LOGPATH=${GITEA_HOME}/log
  29. LOGFILE=${LOGPATH}/gitea.log
  30. RETVAL=0
  31. # Read configuration from /etc/sysconfig/gitea to override defaults
  32. [ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
  33. # Don't do anything if nothing is installed
  34. [ -x ${GITEA_PATH} ] || exit 0
  35. # exit if logpath dir is not created.
  36. [ -x ${LOGPATH} ] || exit 0
  37. DAEMON_OPTS="--check $NAME"
  38. # Set additional options, if any
  39. [ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}"
  40. start() {
  41. cd ${GITEA_HOME}
  42. echo -n "Starting ${SERVICENAME}: "
  43. daemon $DAEMON_OPTS "${GITEA_PATH} web > ${LOGFILE} 2>&1 &"
  44. RETVAL=$?
  45. echo
  46. [ $RETVAL = 0 ] && touch ${LOCKFILE}
  47. return $RETVAL
  48. }
  49. stop() {
  50. cd ${GITEA_HOME}
  51. echo -n "Shutting down ${SERVICENAME}: "
  52. killproc ${NAME}
  53. RETVAL=$?
  54. echo
  55. [ $RETVAL = 0 ] && rm -f ${LOCKFILE}
  56. }
  57. case "$1" in
  58. start)
  59. status ${NAME} > /dev/null 2>&1 && exit 0
  60. start
  61. ;;
  62. stop)
  63. stop
  64. ;;
  65. status)
  66. status ${NAME}
  67. ;;
  68. restart)
  69. stop
  70. start
  71. ;;
  72. reload)
  73. stop
  74. start
  75. ;;
  76. *)
  77. echo "Usage: ${NAME} {start|stop|status|restart}"
  78. exit 1
  79. ;;
  80. esac
  81. exit $RETVAL