Jail boot order

I run both qjail and ezjail on some servers. I have a problem with that some jails requires LDAP access. If it's not found, it will timeout and cause a dreadful slow boot startup.

Is it possible to order what jails should boot first? So I could get the LDAP jail to start before the other jails that depends on it.
 
I'm not aware of a jail boot order configuration tunable, so two solutions come into my mind:
  • define a script to test when the ldap server jail has been started, and place such script as jail_prestart_exec of all other jails.
  • define a rc script for starting the ldap server jail and one for starting all other jails, making a dependency among the two

Just a guess.
 
Hi olav,

when using ezjail, look in the files located in /usr/local/etc/ezjail. If you are familiar with the startup order of rc.d scripts, you know what to do. ;)
 
Thank you for your suggestions. I did actually implement my own rc script that started the jails in my prefered order instead of relying ezjail_enable or qjail_enable.
 
olav said:
Thank you for your suggestions. I did actually implement my own rc script that started the jails in my prefered order instead of relying ezjail_enable or qjail_enable.

Great! It could be interesting to share your solution, if general enough to be applied or customized to other scenarios.
 
man rcorder

You can tune the boot order by using [cmd=]rcorder[/cmd] as ezjail uses it:

Code:
# cd /usr/local/etc/ezjail
# ls | xargs rcorder
ldap
service3
service2

See the following lines in [cmd=]/usr/local/etc/rc.d/ezjail[/cmd]:

Code:
...
do_cmd () {
  # If a jail list is given on command line, process it
  # If not, fetch it from our config directory
  if [ "$*" ]; then
    ...
  else
    [ "${ezjail_stop}" ] && reverse_command="tail -r" || reverse_command="cat"
    [ -d "${ezjail_cfgs}" ] && cd "${ezjail_cfgs}" && ezjail_list=`ls | xargs rcorder | ${reverse_command}`
    echo -n "${message##_}"
  fi
}
...

So see your configuration file [cmd=]/usr/local/etc/ezjail/<jailname>[/cmd], the jail [cmd=]service3[/cmd] requires the jail [cmd=]ldap[/cmd] to be running:
Code:
# To specify the start up order of your ezjails, use these lines to
# create a Jail dependency tree. See rcorder(8) for more details.
#
# PROVIDE: service3
# REQUIRE: ldap
# BEFORE: 
#

HTH, Ralf.
 
Back
Top