Solved Jails configuration

rumate

New Member


Messages: 6

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.
 

bds

Member

Reaction score: 9
Messages: 44

You can use the command "service apache24 onestart" to bring it up if it is not enabled.
 

kpa

Beastie's Twin

Reaction score: 1,796
Messages: 6,307

The jail is supposed to be a complete system so you're expected to configure the services running in it using its own rc.conf(5).
 

ShelLuser

Son of Beastie

Reaction score: 1,671
Messages: 3,512

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!
 
OP
OP
rumate

rumate

New Member


Messages: 6

Thanks everyone for your comments!:) I will continue to explore jails on FreeBSD.
 
Top