]> gitweb @ CieloNegro.org - Rakka.git/blob - rc.d/NetBSD/rakka.in
rc.d/NetBSD/rakka: proper daemonization
[Rakka.git] / rc.d / NetBSD / rakka.in
1 #!/bin/sh
2 # -----------------------------------------------------
3 #           Rakka's rc script for NetBSD
4 # -----------------------------------------------------
5 #        Put this file into your /etc/rc.d/
6 # FreeBSD users should also be able to use this script.
7 # -----------------------------------------------------
8
9 # PROVIDE: rakka
10 # REQUIRE: NETWORKING
11
12 . /etc/rc.subr
13
14 name="rakka"
15 rcvar=$name
16 command="/tmp/launch_rakka.$$"
17 procname="@RAKKA_BINDIR@/rakka"
18 pidfile="@RAKKA_LOCALSTATEDIR@/pid"
19
20 # Dirty hack: rakka can't daemonize itself because of Haskell's
21 # forkProcess limitation.
22 trap "unlink '$command'" EXIT
23 cat <<'EOF' >"$command"
24 #!/bin/sh
25 @RAKKA_BINDIR@/rakka $@ &
26 EOF
27 chmod +x "$command"
28
29 load_rc_config $name
30 run_rc_command "$1"