From 0e0507f3702abfacccca5f7f81d66ec9fa9c22e6 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Tue, 2 Sep 2014 17:39:35 -0700 Subject: [PATCH] Created OpenRC (markdown) --- OpenRC.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 OpenRC.md diff --git a/OpenRC.md b/OpenRC.md new file mode 100644 index 0000000..ae11dbc --- /dev/null +++ b/OpenRC.md @@ -0,0 +1,47 @@ +/etc/init.d/haste-server: +```sh +#!/sbin/runscript + +name="Haste server" +description="Haste is an open-source pastebin software written in node.js" + +: ${haste_user:=haste} +: ${haste_group:=haste} +: ${haste_home:=/opt/haste-server} + +: ${haste_log:=/var/log/haste/haste-server.log} +: ${haste_pidfile:=/run/haste/haste-server.pid} + +node_command="/usr/bin/node" +node_command_args="$haste_home/server.js" + +depend() { + need redis + use net +} + +start() { + ebegin "Starting Haste server" + + checkpath -d -o "$haste_user:$haste_group" -m750 "$(dirname "$haste_pidfile")" + + start-stop-daemon --start \ + --background --quiet \ + --chdir "$haste_home" \ + --user="$haste_user:$haste_group" \ + --make-pidfile --pidfile=$haste_pidfile \ + --stdout "$haste_log" --stderr "$haste_log" \ + --exec $node_command -- $node_command_args + eend $? +} + +stop() { + ebegin "Stopping Haste server" + start-stop-daemon --stop \ + --pidfile=$haste_pidfile \ + --exec $node_command + eend $? +} +``` + +See also [[Installation#gentoo]]. \ No newline at end of file