]> source.dussan.org Git - gitea.git/commitdiff
Rename and update init files to use "gitea" instead of "gogs"
authorSandro Santilli <strk@kbt.io>
Mon, 7 Nov 2016 11:54:17 +0000 (12:54 +0100)
committerSandro Santilli <strk@kbt.io>
Mon, 7 Nov 2016 15:06:21 +0000 (16:06 +0100)
Closes #102

16 files changed:
scripts/init/centos/gitea [new file with mode: 0644]
scripts/init/centos/gogs [deleted file]
scripts/init/debian/gitea [new file with mode: 0644]
scripts/init/debian/gogs [deleted file]
scripts/init/freebsd/gitea [new file with mode: 0644]
scripts/init/freebsd/gogs [deleted file]
scripts/init/openbsd/gitea [new file with mode: 0755]
scripts/init/openbsd/gogs [deleted file]
scripts/init/suse/gitea [new file with mode: 0644]
scripts/init/suse/gogs [deleted file]
scripts/launchd/io.gitea.web.plist [new file with mode: 0644]
scripts/launchd/io.gogs.web.plist [deleted file]
scripts/supervisor/gitea [new file with mode: 0644]
scripts/supervisor/gogs [deleted file]
scripts/systemd/gitea.service [new file with mode: 0644]
scripts/systemd/gogs.service [deleted file]

diff --git a/scripts/init/centos/gitea b/scripts/init/centos/gitea
new file mode 100644 (file)
index 0000000..77c7202
--- /dev/null
@@ -0,0 +1,93 @@
+#!/bin/sh
+#
+#       /etc/rc.d/init.d/gitea
+#
+#       Runs the Gogs Go Git Service.
+#       
+#
+# chkconfig:   - 85 15 
+#
+
+### BEGIN INIT INFO
+# Provides:          gitea
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start gitea at boot time.
+# Description:       Control gitea.
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+# Default values
+
+NAME=gitea
+GITEA_HOME=/home/git/gitea
+GITEA_PATH=${GITEA_HOME}/$NAME
+GITEA_USER=git
+SERVICENAME="Gogs Go Git Service"
+LOCKFILE=/var/lock/subsys/gitea
+LOGPATH=${GITEA_HOME}/log
+LOGFILE=${LOGPATH}/gitea.log
+RETVAL=0
+
+# Read configuration from /etc/sysconfig/gitea to override defaults
+[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
+
+# Don't do anything if nothing is installed
+[ -x ${GITEA_PATH} ] || exit 0
+# exit if logpath dir is not created.
+[ -x ${LOGPATH} ] || exit 0
+
+DAEMON_OPTS="--check $NAME"
+
+# Set additional options, if any
+[ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}"
+
+start() {
+  cd ${GITEA_HOME}
+  echo -n "Starting ${SERVICENAME}: "
+  daemon $DAEMON_OPTS "${GITEA_PATH} web > ${LOGFILE} 2>&1 &"
+  RETVAL=$?
+  echo
+  [ $RETVAL = 0 ] && touch ${LOCKFILE}
+        
+  return $RETVAL
+}
+
+stop() {
+  cd ${GITEA_HOME}
+        echo -n "Shutting down ${SERVICENAME}: "
+        killproc ${NAME}
+        RETVAL=$?
+        echo
+        [ $RETVAL = 0 ] && rm -f ${LOCKFILE} 
+}
+
+case "$1" in
+    start)
+        status ${NAME} > /dev/null 2>&1 && exit 0
+        start
+        ;;
+    stop)
+        stop
+        ;;
+    status)
+        status ${NAME}
+        ;;
+    restart)
+        stop
+        start
+        ;;
+    reload)
+        stop
+        start
+        ;;
+    *)
+        echo "Usage: ${NAME} {start|stop|status|restart}"
+        exit 1
+        ;;
+esac
+exit $RETVAL
diff --git a/scripts/init/centos/gogs b/scripts/init/centos/gogs
deleted file mode 100644 (file)
index 1a9fc27..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/sh
-#
-#       /etc/rc.d/init.d/gogs
-#
-#       Runs the Gogs Go Git Service.
-#       
-#
-# chkconfig:   - 85 15 
-#
-
-### BEGIN INIT INFO
-# Provides:          gogs
-# Required-Start:    $remote_fs $syslog
-# Required-Stop:     $remote_fs $syslog
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start gogs at boot time.
-# Description:       Control gogs.
-### END INIT INFO
-
-# Source function library.
-. /etc/init.d/functions
-
-# Default values
-
-NAME=gogs
-GITEA_HOME=/home/git/gogs
-GITEA_PATH=${GITEA_HOME}/$NAME
-GITEA_USER=git
-SERVICENAME="Gogs Go Git Service"
-LOCKFILE=/var/lock/subsys/gogs
-LOGPATH=${GITEA_HOME}/log
-LOGFILE=${LOGPATH}/gogs.log
-RETVAL=0
-
-# Read configuration from /etc/sysconfig/gogs to override defaults
-[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
-
-# Don't do anything if nothing is installed
-[ -x ${GITEA_PATH} ] || exit 0
-# exit if logpath dir is not created.
-[ -x ${LOGPATH} ] || exit 0
-
-DAEMON_OPTS="--check $NAME"
-
-# Set additional options, if any
-[ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}"
-
-start() {
-  cd ${GITEA_HOME}
-  echo -n "Starting ${SERVICENAME}: "
-  daemon $DAEMON_OPTS "${GITEA_PATH} web > ${LOGFILE} 2>&1 &"
-  RETVAL=$?
-  echo
-  [ $RETVAL = 0 ] && touch ${LOCKFILE}
-        
-  return $RETVAL
-}
-
-stop() {
-  cd ${GITEA_HOME}
-        echo -n "Shutting down ${SERVICENAME}: "
-        killproc ${NAME}
-        RETVAL=$?
-        echo
-        [ $RETVAL = 0 ] && rm -f ${LOCKFILE} 
-}
-
-case "$1" in
-    start)
-        status ${NAME} > /dev/null 2>&1 && exit 0
-        start
-        ;;
-    stop)
-        stop
-        ;;
-    status)
-        status ${NAME}
-        ;;
-    restart)
-        stop
-        start
-        ;;
-    reload)
-        stop
-        start
-        ;;
-    *)
-        echo "Usage: ${NAME} {start|stop|status|restart}"
-        exit 1
-        ;;
-esac
-exit $RETVAL
diff --git a/scripts/init/debian/gitea b/scripts/init/debian/gitea
new file mode 100644 (file)
index 0000000..f822edf
--- /dev/null
@@ -0,0 +1,126 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          gitea
+# Required-Start:    $syslog $network
+# Required-Stop:     $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: A self-hosted Git service written in Go.
+# Description:       A self-hosted Git service written in Go.
+### END INIT INFO
+
+# Author: Danny Boisvert
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Go Git Service"
+NAME=gitea
+SERVICEVERBOSE=yes
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+WORKINGDIR=/home/git/gitea
+DAEMON=$WORKINGDIR/$NAME
+DAEMON_ARGS="web"
+USER=git
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+       # Return
+       #   0 if daemon has been started
+       #   1 if daemon was already running
+       #   2 if daemon could not be started
+       sh -c "USER=$USER start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
+                       --test --chdir $WORKINGDIR --chuid $USER \\
+                       --exec $DAEMON -- $DAEMON_ARGS > /dev/null \\
+                       || return 1"
+       sh -c "USER=$USER start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
+                       --background --chdir $WORKINGDIR --chuid $USER \\
+                       --exec $DAEMON -- $DAEMON_ARGS \\
+                       || return 2"
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+       # Return
+       #   0 if daemon has been stopped
+       #   1 if daemon was already stopped
+       #   2 if daemon could not be stopped
+       #   other if a failure occurred
+       start-stop-daemon --stop --quiet --retry=TERM/1/KILL/5 --pidfile $PIDFILE --name $NAME
+       RETVAL="$?"
+       [ "$RETVAL" = 2 ] && return 2
+       start-stop-daemon --stop --quiet --oknodo --retry=0/1/KILL/5 --exec $DAEMON
+       [ "$?" = 2 ] && return 2
+       # Many daemons don't delete their pidfiles when they exit.
+       rm -f $PIDFILE
+       return "$RETVAL"
+}
+
+
+case "$1" in
+  start)
+       [ "$SERVICEVERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+       do_start
+       case "$?" in
+               0|1) [ "$SERVICEVERBOSE" != no ] && log_end_msg 0 ;;
+               2) [ "$SERVICEVERBOSE" != no ] && log_end_msg 1 ;;
+       esac
+       ;;
+  stop)
+       [ "$SERVICEVERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+       do_stop
+       case "$?" in
+               0|1) [ "$SERVICEVERBOSE" != no ] && log_end_msg 0 ;;
+               2) [ "$SERVICEVERBOSE" != no ] && log_end_msg 1 ;;
+       esac
+       ;;
+  status)
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
+  restart|force-reload)
+       log_daemon_msg "Restarting $DESC" "$NAME"
+       do_stop
+       case "$?" in
+         0|1)
+               do_start
+               case "$?" in
+                       0) log_end_msg 0 ;;
+                       1) log_end_msg 1 ;; # Old process is still running
+                       *) log_end_msg 1 ;; # Failed to start
+               esac
+               ;;
+         *)
+               # Failed to stop
+               log_end_msg 1
+               ;;
+               esac
+       ;;
+  *)
+               echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+               exit 3
+               ;;
+esac
+
+:
diff --git a/scripts/init/debian/gogs b/scripts/init/debian/gogs
deleted file mode 100644 (file)
index 187e23a..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides:          gogs
-# Required-Start:    $syslog $network
-# Required-Stop:     $syslog
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: A self-hosted Git service written in Go.
-# Description:       A self-hosted Git service written in Go.
-### END INIT INFO
-
-# Author: Danny Boisvert
-
-# Do NOT "set -e"
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="Go Git Service"
-NAME=gogs
-SERVICEVERBOSE=yes
-PIDFILE=/var/run/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
-WORKINGDIR=/home/git/gogs
-DAEMON=$WORKINGDIR/$NAME
-DAEMON_ARGS="web"
-USER=git
-
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-# Exit if the package is not installed
-[ -x "$DAEMON" ] || exit 0
-
-# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
-
-# Define LSB log_* functions.
-# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
-# and status_of_proc is working.
-. /lib/lsb/init-functions
-
-#
-# Function that starts the daemon/service
-#
-do_start()
-{
-       # Return
-       #   0 if daemon has been started
-       #   1 if daemon was already running
-       #   2 if daemon could not be started
-       sh -c "USER=$USER start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
-                       --test --chdir $WORKINGDIR --chuid $USER \\
-                       --exec $DAEMON -- $DAEMON_ARGS > /dev/null \\
-                       || return 1"
-       sh -c "USER=$USER start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
-                       --background --chdir $WORKINGDIR --chuid $USER \\
-                       --exec $DAEMON -- $DAEMON_ARGS \\
-                       || return 2"
-}
-
-#
-# Function that stops the daemon/service
-#
-do_stop()
-{
-       # Return
-       #   0 if daemon has been stopped
-       #   1 if daemon was already stopped
-       #   2 if daemon could not be stopped
-       #   other if a failure occurred
-       start-stop-daemon --stop --quiet --retry=TERM/1/KILL/5 --pidfile $PIDFILE --name $NAME
-       RETVAL="$?"
-       [ "$RETVAL" = 2 ] && return 2
-       start-stop-daemon --stop --quiet --oknodo --retry=0/1/KILL/5 --exec $DAEMON
-       [ "$?" = 2 ] && return 2
-       # Many daemons don't delete their pidfiles when they exit.
-       rm -f $PIDFILE
-       return "$RETVAL"
-}
-
-
-case "$1" in
-  start)
-       [ "$SERVICEVERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
-       do_start
-       case "$?" in
-               0|1) [ "$SERVICEVERBOSE" != no ] && log_end_msg 0 ;;
-               2) [ "$SERVICEVERBOSE" != no ] && log_end_msg 1 ;;
-       esac
-       ;;
-  stop)
-       [ "$SERVICEVERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
-       do_stop
-       case "$?" in
-               0|1) [ "$SERVICEVERBOSE" != no ] && log_end_msg 0 ;;
-               2) [ "$SERVICEVERBOSE" != no ] && log_end_msg 1 ;;
-       esac
-       ;;
-  status)
-       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
-       ;;
-  restart|force-reload)
-       log_daemon_msg "Restarting $DESC" "$NAME"
-       do_stop
-       case "$?" in
-         0|1)
-               do_start
-               case "$?" in
-                       0) log_end_msg 0 ;;
-                       1) log_end_msg 1 ;; # Old process is still running
-                       *) log_end_msg 1 ;; # Failed to start
-               esac
-               ;;
-         *)
-               # Failed to stop
-               log_end_msg 1
-               ;;
-               esac
-       ;;
-  *)
-               echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
-               exit 3
-               ;;
-esac
-
-:
diff --git a/scripts/init/freebsd/gitea b/scripts/init/freebsd/gitea
new file mode 100644 (file)
index 0000000..898606f
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: gitea
+# REQUIRE: NETWORKING SYSLOG
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable gitea:
+#
+#gitea_enable="YES"
+
+. /etc/rc.subr
+
+name="gitea"
+rcvar="gitea_enable"
+
+load_rc_config $name
+
+: ${gitea_user:="git"}
+: ${gitea_enable:="NO"}
+: ${gitea_directory:="/home/git"}
+
+command="${gitea_directory}/gitea web"
+procname="$(echo $command |cut -d' ' -f1)"
+
+pidfile="${gitea_directory}/${name}.pid"
+
+start_cmd="${name}_start"
+stop_cmd="${name}_stop"
+
+gitea_start() {
+       cd ${gitea_directory}
+       export USER=${gitea_user}
+       export HOME=/usr/home/${gitea_user}
+       /usr/sbin/daemon -f -u ${gitea_user} -p ${pidfile} $command
+}
+
+gitea_stop() {
+       if [ ! -f $pidfile ]; then
+               echo "GITEA PID File not found. Maybe GITEA is not running?"
+       else
+               kill $(cat $pidfile)
+       fi
+}
+
+run_rc_command "$1"
diff --git a/scripts/init/freebsd/gogs b/scripts/init/freebsd/gogs
deleted file mode 100644 (file)
index 8fc0359..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-# PROVIDE: gogs
-# REQUIRE: NETWORKING SYSLOG
-# KEYWORD: shutdown
-#
-# Add the following lines to /etc/rc.conf to enable gogs:
-#
-#gogs_enable="YES"
-
-. /etc/rc.subr
-
-name="gogs"
-rcvar="gogs_enable"
-
-load_rc_config $name
-
-: ${gogs_user:="git"}
-: ${gogs_enable:="NO"}
-: ${gogs_directory:="/home/git"}
-
-command="${gogs_directory}/gogs web"
-procname="$(echo $command |cut -d' ' -f1)"
-
-pidfile="${gogs_directory}/${name}.pid"
-
-start_cmd="${name}_start"
-stop_cmd="${name}_stop"
-
-gogs_start() {
-       cd ${gogs_directory}
-       export USER=${gogs_user}
-       export HOME=/usr/home/${gogs_user}
-       /usr/sbin/daemon -f -u ${gogs_user} -p ${pidfile} $command
-}
-
-gogs_stop() {
-       if [ ! -f $pidfile ]; then
-               echo "GITEA PID File not found. Maybe GITEA is not running?"
-       else
-               kill $(cat $pidfile)
-       fi
-}
-
-run_rc_command "$1"
diff --git a/scripts/init/openbsd/gitea b/scripts/init/openbsd/gitea
new file mode 100755 (executable)
index 0000000..c43190b
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $OpenBSD$
+
+daemon="/home/git/gitea/gitea"
+daemon_user="git"
+daemon_flags="web"
+
+gitea_directory="/home/git/gitea"
+
+rc_bg=YES
+
+. /etc/rc.d/rc.subr
+
+rc_start() {
+       ${rcexec} "cd ${gitea_directory}; ${daemon} ${daemon_flags} ${_bg}"
+}
+
+rc_cmd $1
diff --git a/scripts/init/openbsd/gogs b/scripts/init/openbsd/gogs
deleted file mode 100755 (executable)
index 95fcf16..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-#
-# $OpenBSD$
-
-daemon="/home/git/gogs/gogs"
-daemon_user="git"
-daemon_flags="web"
-
-gogs_directory="/home/git/gogs"
-
-rc_bg=YES
-
-. /etc/rc.d/rc.subr
-
-rc_start() {
-       ${rcexec} "cd ${gogs_directory}; ${daemon} ${daemon_flags} ${_bg}"
-}
-
-rc_cmd $1
diff --git a/scripts/init/suse/gitea b/scripts/init/suse/gitea
new file mode 100644 (file)
index 0000000..7f7d675
--- /dev/null
@@ -0,0 +1,115 @@
+#!/bin/sh
+#
+#       /etc/init.d/gitea
+#
+#       Runs the Gogs Go Git Service.
+#
+
+### BEGIN INIT INFO
+# Provides:          gitea
+# Required-Start:    $remote_fs
+# Required-Stop:     $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start gitea at boot time.
+# Description:       Control gitea.
+### END INIT INFO
+
+# Default values
+
+NAME=gitea
+GITEA_HOME=/home/git/gitea
+GITEA_PATH=${GITEA_HOME}/$NAME
+GITEA_USER=git
+SERVICENAME="Go Git Service"
+LOCKFILE=/var/lock/subsys/gitea
+LOGPATH=${GITEA_HOME}/log
+LOGFILE=${LOGPATH}/error.log
+# gitea creates its own gitea.log from stdout
+RETVAL=0
+
+# Read configuration from /etc/sysconfig/gitea to override defaults
+[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
+
+# Don't do anything if nothing is installed
+test -x ${GITEA_PATH} || { echo "$NAME not installed";
+       if [ "$1" = "stop" ]; then exit 0;
+       else exit 5; fi; }
+
+# exit if logpath dir is not created.
+test -r ${LOGPATH} || { echo "$LOGPATH not existing";
+       if [ "$1" = "stop" ]; then exit 0;
+       else exit 6; fi; }
+
+# Source function library.
+. /etc/rc.status
+
+# Reset status of this service
+rc_reset
+
+
+case "$1" in
+    start)
+               echo -n "Starting ${SERVICENAME} "
+
+               # As we can't use startproc, we have to check ourselves if the service is already running
+               /sbin/checkproc ${GITEA_PATH}
+               if [ $? -eq 0 ]; then
+                       # return skipped as service is already running
+                       (exit 5)
+               else
+                       su - ${GITEA_USER} -c "USER=${GITEA_USER} ${GITEA_PATH} web 2>&1 >>${LOGFILE} &"
+               fi
+
+               # Remember status and be verbose
+               rc_status -v
+       ;;
+
+       stop)
+               echo -n "Shutting down ${SERVICENAME} "
+
+               ## Stop daemon with killproc(8) and if this fails
+               ## killproc sets the return value according to LSB.
+               /sbin/killproc ${GITEA_PATH}
+
+               # Remember status and be verbose
+               rc_status -v
+       ;;
+
+       restart)
+               ## Stop the service and regardless of whether it was
+               ## running or not, start it again.
+               $0 stop
+               $0 start
+
+               # Remember status and be quiet
+               rc_status
+       ;;
+
+       status)
+               echo -n "Checking for ${SERVICENAME} "
+               ## Check status with checkproc(8), if process is running
+               ## checkproc will return with exit status 0.
+
+               # Return value is slightly different for the status command:
+               # 0 - service up and running
+               # 1 - service dead, but /var/run/  pid  file exists
+               # 2 - service dead, but /var/lock/ lock file exists
+               # 3 - service not running (unused)
+               # 4 - service status unknown :-(
+               # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
+
+               # NOTE: checkproc returns LSB compliant status values.
+               /sbin/checkproc ${GITEA_PATH}
+               # NOTE: rc_status knows that we called this init script with
+               # "status" option and adapts its messages accordingly.
+               rc_status -v
+       ;;
+
+    *)
+               echo "Usage: $0 {start|stop|status|restart}"
+               exit 1
+       ;;
+
+esac
+rc_exit
diff --git a/scripts/init/suse/gogs b/scripts/init/suse/gogs
deleted file mode 100644 (file)
index da5f795..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/sh
-#
-#       /etc/init.d/gogs
-#
-#       Runs the Gogs Go Git Service.
-#
-
-### BEGIN INIT INFO
-# Provides:          gogs
-# Required-Start:    $remote_fs
-# Required-Stop:     $remote_fs
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start gogs at boot time.
-# Description:       Control gogs.
-### END INIT INFO
-
-# Default values
-
-NAME=gogs
-GITEA_HOME=/home/git/gogs
-GITEA_PATH=${GITEA_HOME}/$NAME
-GITEA_USER=git
-SERVICENAME="Go Git Service"
-LOCKFILE=/var/lock/subsys/gogs
-LOGPATH=${GITEA_HOME}/log
-LOGFILE=${LOGPATH}/error.log
-# gogs creates its own gogs.log from stdout
-RETVAL=0
-
-# Read configuration from /etc/sysconfig/gogs to override defaults
-[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
-
-# Don't do anything if nothing is installed
-test -x ${GITEA_PATH} || { echo "$NAME not installed";
-       if [ "$1" = "stop" ]; then exit 0;
-       else exit 5; fi; }
-
-# exit if logpath dir is not created.
-test -r ${LOGPATH} || { echo "$LOGPATH not existing";
-       if [ "$1" = "stop" ]; then exit 0;
-       else exit 6; fi; }
-
-# Source function library.
-. /etc/rc.status
-
-# Reset status of this service
-rc_reset
-
-
-case "$1" in
-    start)
-               echo -n "Starting ${SERVICENAME} "
-
-               # As we can't use startproc, we have to check ourselves if the service is already running
-               /sbin/checkproc ${GITEA_PATH}
-               if [ $? -eq 0 ]; then
-                       # return skipped as service is already running
-                       (exit 5)
-               else
-                       su - ${GITEA_USER} -c "USER=${GITEA_USER} ${GITEA_PATH} web 2>&1 >>${LOGFILE} &"
-               fi
-
-               # Remember status and be verbose
-               rc_status -v
-       ;;
-
-       stop)
-               echo -n "Shutting down ${SERVICENAME} "
-
-               ## Stop daemon with killproc(8) and if this fails
-               ## killproc sets the return value according to LSB.
-               /sbin/killproc ${GITEA_PATH}
-
-               # Remember status and be verbose
-               rc_status -v
-       ;;
-
-       restart)
-               ## Stop the service and regardless of whether it was
-               ## running or not, start it again.
-               $0 stop
-               $0 start
-
-               # Remember status and be quiet
-               rc_status
-       ;;
-
-       status)
-               echo -n "Checking for ${SERVICENAME} "
-               ## Check status with checkproc(8), if process is running
-               ## checkproc will return with exit status 0.
-
-               # Return value is slightly different for the status command:
-               # 0 - service up and running
-               # 1 - service dead, but /var/run/  pid  file exists
-               # 2 - service dead, but /var/lock/ lock file exists
-               # 3 - service not running (unused)
-               # 4 - service status unknown :-(
-               # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
-
-               # NOTE: checkproc returns LSB compliant status values.
-               /sbin/checkproc ${GITEA_PATH}
-               # NOTE: rc_status knows that we called this init script with
-               # "status" option and adapts its messages accordingly.
-               rc_status -v
-       ;;
-
-    *)
-               echo "Usage: $0 {start|stop|status|restart}"
-               exit 1
-       ;;
-
-esac
-rc_exit
diff --git a/scripts/launchd/io.gitea.web.plist b/scripts/launchd/io.gitea.web.plist
new file mode 100644 (file)
index 0000000..6181ea1
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+       <dict>
+               <key>Label</key>
+               <string>io.gitea.web</string>
+               <!-- assumes Gogs is running under 'git' account -->
+               <!-- modify below to reflect your settings -->
+               <key>UserName</key>
+               <string>git</string>
+               <key>GroupName</key>
+               <string>git</string>
+               <key>ProgramArguments</key>
+               <array>
+                       <!-- assumes Gogs is installed in /Users/git/gitea -->
+                       <!-- modify below to reflect your settings -->
+                       <string>/Users/git/gitea/gitea</string>
+                       <string>web</string>
+               </array>
+               <key>RunAtLoad</key>
+               <true/>
+               <key>KeepAlive</key>
+               <true/>
+               <!-- assumes Gogs is installed in /Users/git/gitea -->
+               <!-- modify below to reflect your settings -->
+               <key>WorkingDirectory</key>
+               <string>/Users/git/gitea/</string>
+               <key>StandardOutPath</key>
+               <string>/Users/git/gitea/log/stdout.log</string>
+               <key>StandardErrorPath</key>
+               <string>/Users/git/gitea/log/stderr.log</string>
+               <!-- default 256 is too low for Gogs needs using parallel pipes -->
+               <key>SoftResourceLimits</key>
+               <dict>
+                       <key>NumberOfFiles</key>
+                       <integer>8192</integer>
+               </dict>
+       </dict>
+</plist>
diff --git a/scripts/launchd/io.gogs.web.plist b/scripts/launchd/io.gogs.web.plist
deleted file mode 100644 (file)
index 2a5ec7d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-       <dict>
-               <key>Label</key>
-               <string>io.gogs.web</string>
-               <!-- assumes Gogs is running under 'git' account -->
-               <!-- modify below to reflect your settings -->
-               <key>UserName</key>
-               <string>git</string>
-               <key>GroupName</key>
-               <string>git</string>
-               <key>ProgramArguments</key>
-               <array>
-                       <!-- assumes Gogs is installed in /Users/git/gogs -->
-                       <!-- modify below to reflect your settings -->
-                       <string>/Users/git/gogs/gogs</string>
-                       <string>web</string>
-               </array>
-               <key>RunAtLoad</key>
-               <true/>
-               <key>KeepAlive</key>
-               <true/>
-               <!-- assumes Gogs is installed in /Users/git/gogs -->
-               <!-- modify below to reflect your settings -->
-               <key>WorkingDirectory</key>
-               <string>/Users/git/gogs/</string>
-               <key>StandardOutPath</key>
-               <string>/Users/git/gogs/log/stdout.log</string>
-               <key>StandardErrorPath</key>
-               <string>/Users/git/gogs/log/stderr.log</string>
-               <!-- default 256 is too low for Gogs needs using parallel pipes -->
-               <key>SoftResourceLimits</key>
-               <dict>
-                       <key>NumberOfFiles</key>
-                       <integer>8192</integer>
-               </dict>
-       </dict>
-</plist>
diff --git a/scripts/supervisor/gitea b/scripts/supervisor/gitea
new file mode 100644 (file)
index 0000000..a8a908d
--- /dev/null
@@ -0,0 +1,16 @@
+[program:gitea]
+directory=/home/git/go/src/github.com/go-gitea/gitea/
+command=/home/git/go/src/github.com/go-gitea/gitea/gitea web
+autostart=true
+autorestart=true
+startsecs=10
+stdout_logfile=/var/log/gitea/stdout.log
+stdout_logfile_maxbytes=1MB
+stdout_logfile_backups=10
+stdout_capture_maxbytes=1MB
+stderr_logfile=/var/log/gitea/stderr.log
+stderr_logfile_maxbytes=1MB
+stderr_logfile_backups=10
+stderr_capture_maxbytes=1MB
+user = git
+environment = HOME="/home/git", USER="git"
\ No newline at end of file
diff --git a/scripts/supervisor/gogs b/scripts/supervisor/gogs
deleted file mode 100644 (file)
index 3932352..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-[program:gogs]
-directory=/home/git/go/src/github.com/go-gitea/gitea/
-command=/home/git/go/src/github.com/go-gitea/gitea/gogs web
-autostart=true
-autorestart=true
-startsecs=10
-stdout_logfile=/var/log/gogs/stdout.log
-stdout_logfile_maxbytes=1MB
-stdout_logfile_backups=10
-stdout_capture_maxbytes=1MB
-stderr_logfile=/var/log/gogs/stderr.log
-stderr_logfile_maxbytes=1MB
-stderr_logfile_backups=10
-stderr_capture_maxbytes=1MB
-user = git
-environment = HOME="/home/git", USER="git"
\ No newline at end of file
diff --git a/scripts/systemd/gitea.service b/scripts/systemd/gitea.service
new file mode 100644 (file)
index 0000000..48ef732
--- /dev/null
@@ -0,0 +1,26 @@
+[Unit]
+Description=Gogs (Go Git Service)
+After=syslog.target
+After=network.target
+#After=mysqld.service
+#After=postgresql.service
+#After=memcached.service
+#After=redis.service
+
+[Service]
+# Modify these two values and uncomment them if you have
+# repos with lots of files and get an HTTP error 500 because
+# of that
+###
+#LimitMEMLOCK=infinity
+#LimitNOFILE=65535
+Type=simple
+User=git
+Group=git
+WorkingDirectory=/home/git/gitea
+ExecStart=/home/git/gitea/gitea web
+Restart=always
+Environment=USER=git HOME=/home/git
+
+[Install]
+WantedBy=multi-user.target
diff --git a/scripts/systemd/gogs.service b/scripts/systemd/gogs.service
deleted file mode 100644 (file)
index e0db5ec..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-[Unit]
-Description=Gogs (Go Git Service)
-After=syslog.target
-After=network.target
-#After=mysqld.service
-#After=postgresql.service
-#After=memcached.service
-#After=redis.service
-
-[Service]
-# Modify these two values and uncomment them if you have
-# repos with lots of files and get an HTTP error 500 because
-# of that
-###
-#LimitMEMLOCK=infinity
-#LimitNOFILE=65535
-Type=simple
-User=git
-Group=git
-WorkingDirectory=/home/git/gogs
-ExecStart=/home/git/gogs/gogs web
-Restart=always
-Environment=USER=git HOME=/home/git
-
-[Install]
-WantedBy=multi-user.target