From effb9fcb9a8abed185e6dcd1a743c5f139a8480d Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Wed, 21 Feb 2018 16:16:30 +0000 Subject: rough openrc init script --- init-script | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 init-script diff --git a/init-script b/init-script new file mode 100755 index 0000000..6dba4f0 --- /dev/null +++ b/init-script @@ -0,0 +1,35 @@ +#!/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 $? +} -- cgit v1.2.3