From 34bbf39e19a467003afb1c8f0e7e9ed3f2f36673 Mon Sep 17 00:00:00 2001 From: David Hofmann Date: Tue, 4 Aug 2020 17:47:33 +0200 Subject: [PATCH] Add service scripts for FreeBSD --- .../distrib/linux/install-service-freebsd.sh | 2 + src/main/distrib/linux/service-freebsd.sh | 49 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/main/distrib/linux/install-service-freebsd.sh create mode 100644 src/main/distrib/linux/service-freebsd.sh diff --git a/src/main/distrib/linux/install-service-freebsd.sh b/src/main/distrib/linux/install-service-freebsd.sh new file mode 100644 index 00000000..727779cf --- /dev/null +++ b/src/main/distrib/linux/install-service-freebsd.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sudo cp service-freebsd.sh /usr/local/etc/rc.d/gitblit diff --git a/src/main/distrib/linux/service-freebsd.sh b/src/main/distrib/linux/service-freebsd.sh new file mode 100644 index 00000000..513e64c4 --- /dev/null +++ b/src/main/distrib/linux/service-freebsd.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# PROVIDE: gitblit +# BEFORE: LOGIN +# KEYWORD: shutdown + +PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" + +. /etc/rc.subr + +name="gitblit" +rcvar="gitblit_enable" + +pidfile="/var/run/${name}.pid" + +start_cmd="${name}_start" +stop_cmd="${name}_stop" +restart_cmd="${name}_restart" + + +# change theses values (default values) +GITBLIT_PATH=/opt/gitblit +GITBLIT_BASE_FOLDER=/opt/gitblit/data +. ${GITBLIT_PATH}/java-proxy-config.sh +COMMAND_LINE="java -server -Xmx1024M ${JAVA_PROXY_CONFIG} -Djava.awt.headless=true -cp gitblit.jar:ext/* com.gitblit.GitBlitServer --baseFolder $GITBLIT_BASE_FOLDER" + +gitblit_start() +{ + echo "Starting Gitblit Server..." + cd $GITBLIT_PATH + $COMMAND_LINE --dailyLogFile & +} + +gitblit_stop() +{ + echo "Stopping Gitblit Server..." + cd $GITBLIT_PATH + $COMMAND_LINE --stop > /dev/null & +} + +gitblit_restart() +{ + $0 stop + sleep 5 + $0 start +} + +load_rc_config $name +run_rc_command "$1" -- 2.39.5