Skip to content

Instantly share code, notes, and snippets.

@fliiiix
Created August 6, 2017 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fliiiix/c2772fcc7056baac170aad9ab2a87d21 to your computer and use it in GitHub Desktop.
Save fliiiix/c2772fcc7056baac170aad9ab2a87d21 to your computer and use it in GitHub Desktop.
#!/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