I have a piece of software running in jails on our servers, I wrote a script to assemble the jail (although this could just be expanding a tar file, and copying in the service configuration file), and add to jail.conf, (maybe add to rc.conf.local if you want to autostart). I didn't need to sysctl, or rctl. I also wrote a small rc file (that just calls /usr/sbin/jail -c name to start, and jail -r name to stop)
in jail.conf i just have
stud {
path = "/usr/local/jails/jail_name";
ip4 = "inherit";
host.hostname = "jail_name.example.net";
securelevel = 4;
devfs_ruleset = 10;
exec.start = "/bin/service --config=/etc/service.conf";
mount.devfs;
exec.system_jail_user;
exec.jail_user=jail_name;
exec.poststart="/usr/local/bin/jail_ipfw";
}
(ok, i also setup a devfs rule, because i had issues with built in ones and various patch levels of FreeBSD -- and my service needs access to /dev/random)The only non-obvious thing is you need /libexec/ld-elf.so.1 in order to run dynamically linked libraries.