#!/sbin/openrc-run thisdir="$(dirname "$(readlink -f "$RC_SERVICE")")" export HOME="$thisdir" description="syntax highlighter service" : ${pidfile:=/run/color.pid} : ${instances:=2} : ${logbase:=/var/log/color} depend() { use net } my_args=( --instances "$instances" --output "${logbase}.out" --error "${logbase}.err" --pid "$pidfile" --silent ) start() { ebegin "Starting color" "${thisdir}/node_modules/.bin/pm2" \ "${my_args[@]}" \ --name color \ start "${thisdir}/index.js" eend $? } stop() { ebegin "Stopping color" "${thisdir}/node_modules/.bin/pm2" \ "${my_args[@]}" \ kill eend $? }