This is everything that I've done:
I wrote the rc.d/
script, it looks like this:
#!/bin/ksh
daemon="/usr/local/sbin/dynaruby"
name="dynaruby"
. /etc/rc.d/rc.subr
rc_cmd $1
The program needs an environment variable to work. I tried setting it up following the man page of rc.d
. It says to create an entry in login.conf
, so I did, and that looks like this:
dynaruby:\
:setenv=DYNARUBY_KEY="BupCxeBEflVyNK05ypuz25bXuoRc9Rg61qKnOBohyH0=,Xwsirr99KDqkz3Ncytn2AA==":\
:tc=default:
I also did cap_mkdb /etc/login.conf
for good measure, but still when I do rcctl reload/start dynaruby
I always get dynaruby(failed)
. I tried having a file entry in /etc/login.conf.d/
without :tc=default:
(tried both :tc=daemon:
and nothing at all) instead of having it inside the main login.conf
but with the same results. Any insight on how I could debug this further would be greatly appreciated.
EDIT: I forgot to say that I also added the service in /etc/rc.conf.local
I've managed to force the env variable into the script by overriding the default rc_start
#!/bin/ksh
daemon="/usr/local/sbin/dynaruby"
. /etc/rc.d/rc.subr
rc_start() {
export DYNARUBY_KEY="YOUR,KEY"
exec /usr/local/sbin/dynaruby &
}
rc_cmd $1
This is not the intended way to do this, but I guess it works. Without exec
the program will run fine until the rc.d
framework kills it with error Timeout: No process found
. This might be fixed by overriding the pexp
too, but I found just using exec / &
to be the easiest.