#!/sbin/runscript PID="/var/run/${RC_SVCNAME}.pid" LOG="/var/log/${RC_SVCNAME}.log" : ${EXEC:="/usr/bin/rethinkdb"} : ${ASSETS:="/usr/share/rethinkdb_web_assets"} : ${DATA:="/var/lib/${RC_SVCNAME}"} : ${R_USER:="rethinkdb"} : ${R_GROUP:="daemon"} start() { BINDARG="" JOINARG="" for ip in ${JOIN} do JOINARG="${JOINARG} --join $ip" done for ip in ${BIND} do BINDARG="${BINDARG} --bind $ip" done if [ "${HTTP_PORT}" = "off" ] then HTTP_PORT="--no-http-admin" elif [ "${HTTP_PORT}" != "" ] then HTTP_PORT="--http-port ${HTTP_PORT}" fi ebegin "Starting ${RC_SVCNAME}" start-stop-daemon --start --exec ${EXEC} \ --stderr ${LOG} --pidfile ${PID} --make-pidfile \ --user ${R_USER} --group ${R_GROUP} --background \ -- serve --directory ${DATA}${BINDARG} \ --web-static-directory ${ASSETS} \ ${HTTP_PORT} ${JOINARG} \ ${PORT_OFFSET:+"--port-offset ${PORT_OFFSET}"} \ ${CLUSTER_PORT:+"--cluster-port ${CLUSTER_PORT}"} \ ${DRIVER_PORT:+"--driver-port ${DRIVER_PORT}"} \ ${CORES:+"--cores ${CORES}"} eend $? } stop() { ebegin "Stopping ${RC_SVCNAME}" start-stop-daemon --stop --pidfile ${PID} eend $? }