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_startThis is not the intended way to do this, but I guess it works. Without
execthe program will run fine until therc.dframework kills it with errorTimeout: No process found. This might be fixed by overriding thepexptoo, but I found just usingexec / &to be the easiest.