Created OpenRC (markdown)

Jakub Jirutka 2014-09-02 17:39:35 -07:00
parent 9627e20765
commit 0e0507f370
1 changed files with 47 additions and 0 deletions

47
OpenRC.md Normal file

@ -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]].