summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorClint Armstrong <clint@clintarmstrong.net>2015-01-30 22:51:38 -0500
committerClint Armstrong <clint@clintarmstrong.net>2015-01-30 22:51:38 -0500
commit7e3d66673d7223f17f1f290423360eabd7fb0751 (patch)
tree89ef5841cd4cf837ec6f904196568df7341d922d /scripts
parentfb9dcfa921d72900936ddc7533861c33d847aa00 (diff)
downloadgitea-7e3d66673d7223f17f1f290423360eabd7fb0751.tar.gz
gitea-7e3d66673d7223f17f1f290423360eabd7fb0751.zip
Add freebsd rc script
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rc/freebsd/gogs46
1 files changed, 46 insertions, 0 deletions
diff --git a/scripts/rc/freebsd/gogs b/scripts/rc/freebsd/gogs
new file mode 100644
index 0000000000..df13ee0d9c
--- /dev/null
+++ b/scripts/rc/freebsd/gogs
@@ -0,0 +1,46 @@
+#!/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}/scripts/start.sh"
+
+pidfile="${gogs_directory}/${name}.pid"
+
+start_cmd="${name}_start"
+stop_cmd="${name}_stop"
+
+gogs_start() {
+ cd ${gogs_directory}
+ export USER=${gogs_user}
+ export HOME=${gogs_directory}
+ /usr/sbin/daemon -f -u ${gogs_user} -p ${pidfile} $command
+}
+
+gogs_stop() {
+ if [ ! -f $pidfile ]; then
+ echo "GOGS PID File not found. Maybe GOGS is not running?"
+ else
+ kill $(cat $pidfile)
+ fi
+}
+
+run_rc_command "$1"