Solved Jails configuration

Hi all,
I wonder if it is possible to define automatically starting services in /etc/jail.conf? I can set an IP address for a jail, define the NIC to use, give a hostname and other variables. I couldn't start apache24 using exec.start, I assume, because this service isn't enabled in the jail's rc.conf. It started once I created an rc.conf and put 'apache24_enable="YES"' in it.
Since there is no rc.conf files in newly created jails. It would be quite handy to keep such settings in one file.
 
I wonder if it is possible to define automatically starting services in /etc/jail.conf?
In theory, yes. But the best way is to simply fire up /etc/rc which will then fire up the rest of the services which you enabled. So, for example (from my /etc/jail.conf):
Code:
        path = /opt/jails/psi;
        exec.start = "sh /etc/rc";
        exec.stop = "sh /etc/rc.shutdown";
        persist;
So if I want to configure something in Psi I simply log on ( # jexec psi), dis- or en-able the service(s) I need (for example using the sysrc command) and then everything will be fired up automatically once I start the jail.

And, also important, the services will also be cleanly shutdown.

Be sure to carefully check up on the manpages for jail(8) and jail.conf(5) because those also explain this procedure.

Hope this can help!
 
Back
Top