Skip to content

Instantly share code, notes, and snippets.

@fliiiix
Created August 14, 2016 12:29
Show Gist options
  • Select an option

  • Save fliiiix/319f08ac553f95b31342250971a66260 to your computer and use it in GitHub Desktop.

Select an option

Save fliiiix/319f08ac553f95b31342250971a66260 to your computer and use it in GitHub Desktop.
gollum wiki freebsd deamon file (place it in /usr/local/etc/rc.d and mark it as executable)
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: gollum
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# gollum_enable (bool): Set to NO by default.
# Set it to YES to enable web.
#
. /etc/rc.subr
# setup enviroment
export PATH=$PATH:/usr/local/bin
export LANG="en_GB.UTF-8"
export LC_CTYPE="en_GB.UTF-8"
name="gollum"
rcvar="${name}_enable"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
PID=/var/run/${name}.pid
DATA_DIR=/usr/local/data/system-wiki
gollum_start()
{
echo "start ${name}"
cd $DATA_DIR
# start gollum and restart it if it fails
daemon -P $PID -r -f gollum --host 0.0.0.0 --port 80 --live-preview
}
gollum_stop()
{
echo "stop ${name}"
kill `cat $PID`
}
load_rc_config $name
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment