本站源代码
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.

94 satır
1.9KB

  1. #!/bin/sh
  2. #
  3. # /etc/rc.d/init.d/gitea
  4. #
  5. # Runs the Gitea Git with a cup of tea.
  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=/var/lib/${NAME}
  24. GITEA_PATH=/usr/local/bin/${NAME}
  25. GITEA_USER=git
  26. SERVICENAME="Gitea - Git with a cup of tea"
  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 -c /etc/${NAME}/app.ini > ${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
上海开阖软件有限公司 沪ICP备12045867号-1