aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/init/debian
diff options
context:
space:
mode:
authorThomas Boerger <thomas@webhippie.de>2017-03-15 13:30:00 +0100
committerGitHub <noreply@github.com>2017-03-15 13:30:00 +0100
commita06c3ad2c02a5473184711be6dbf1b30f0299e11 (patch)
treece0ac065a6afa843ce298d00d1761b5cf48accf9 /contrib/init/debian
parent09fe4a2ae9dfa8b3bc8a5039d0feab1e1a34d07b (diff)
downloadgitea-a06c3ad2c02a5473184711be6dbf1b30f0299e11.tar.gz
gitea-a06c3ad2c02a5473184711be6dbf1b30f0299e11.zip
Synced gitignores with github repo (#1245)
* Renamed scripts directory into contrib * Added script to download gitignores from github * Synced gitignores with github repo
Diffstat (limited to 'contrib/init/debian')
-rw-r--r--contrib/init/debian/gitea86
1 files changed, 86 insertions, 0 deletions
diff --git a/contrib/init/debian/gitea b/contrib/init/debian/gitea
new file mode 100644
index 0000000000..0cde38a6bd
--- /dev/null
+++ b/contrib/init/debian/gitea
@@ -0,0 +1,86 @@
+#!/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
+USERBIND="setcap cap_net_bind_service=+ep"
+STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/1/KILL/5}"
+
+# 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
+
+do_start()
+{
+ $USERBIND $DAEMON
+ sh -c "USER=$USER start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
+ --background --chdir $WORKINGDIR --chuid $USER \\
+ --exec $DAEMON -- $DAEMON_ARGS"
+}
+
+do_stop()
+{
+ start-stop-daemon --stop --quiet --retry=$STOP_SCHEDULE --pidfile $PIDFILE --name $NAME --oknodo
+ rm -f $PIDFILE
+}
+
+do_status()
+{
+ if [ -f $PIDFILE ]; then
+ if kill -0 $(cat "$PIDFILE"); then
+ echo "$NAME is running, PID is $(cat $PIDFILE)"
+ else
+ echo "$NAME process is dead, but pidfile exists"
+ fi
+ else
+ echo "$NAME is not running"
+ fi
+}
+
+case "$1" in
+ start)
+ echo "Starting $DESC" "$NAME"
+ do_start
+ ;;
+ stop)
+ echo "Stopping $DESC" "$NAME"
+ do_stop
+ ;;
+ status)
+ do_status
+ ;;
+ restart)
+ echo "Restarting $DESC" "$NAME"
+ do_stop
+ do_start
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
+ exit 2
+ ;;
+esac
+
+exit 0