Created
August 6, 2017 15:09
-
-
Save fliiiix/c2772fcc7056baac170aad9ab2a87d21 to your computer and use it in GitHub Desktop.
This file contains 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: OCR worker | |
# REQUIRE: LOGIN | |
# KEYWORD: shutdown | |
# | |
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf | |
# to enable this service: | |
# | |
# ocr_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 REDIS_HOST=127.0.0.1 | |
name="ocr" | |
rcvar="${name}_enable" | |
start_cmd="${name}_start" | |
stop_cmd="${name}_stop" | |
PID=/var/run/${name}.pid | |
ocr_start() | |
{ | |
echo "start ${name}" | |
# start gollum and restart it if it fails | |
daemon -P $PID -r -f -u www node /home/node/worker/dist/main.js | |
} | |
ocr_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