Created
August 14, 2016 12:29
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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