diff options
author | Gianni Ceccarelli <gianni.ceccarelli@broadbean.com> | 2018-02-21 16:16:30 +0000 |
---|---|---|
committer | Gianni Ceccarelli <gianni.ceccarelli@broadbean.com> | 2018-02-21 16:16:30 +0000 |
commit | effb9fcb9a8abed185e6dcd1a743c5f139a8480d (patch) | |
tree | 72c1efda4e8d8fb45b8df773cca510ddb5c93cb8 /init-script | |
parent | save logs locally (diff) | |
download | color-effb9fcb9a8abed185e6dcd1a743c5f139a8480d.tar.gz color-effb9fcb9a8abed185e6dcd1a743c5f139a8480d.tar.bz2 color-effb9fcb9a8abed185e6dcd1a743c5f139a8480d.zip |
rough openrc init script
Diffstat (limited to 'init-script')
-rwxr-xr-x | init-script | 35 |
1 files changed, 35 insertions, 0 deletions
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 $? +} |