More fixes for babeld init script
Ensure interface files are created before pasting them into config file Ensure babeld is reasonable respawned on crash
This commit is contained in:
parent
edad3b3ec5
commit
bde0c003a0
1 changed files with 16 additions and 9 deletions
|
@ -177,6 +177,10 @@ babel_configpaths() {
|
|||
start_service() {
|
||||
mkdir -p /var/lib
|
||||
mkdir -p /var/etc
|
||||
mkdir -p "$OTHERCONFIGDIR"
|
||||
|
||||
# Start by emptying the generated config file
|
||||
>"$CONFIGFILE"
|
||||
|
||||
# First load the whole config file, without callbacks, so that we are
|
||||
# aware of all "ignore" options in the second pass. This also allows
|
||||
|
@ -186,14 +190,6 @@ start_service() {
|
|||
# Configure alternative configuration file and directory
|
||||
config_foreach babel_configpaths "general"
|
||||
|
||||
# Start by emptying the generated config file
|
||||
>"$CONFIGFILE"
|
||||
# Import dynamic config files
|
||||
mkdir -p "$OTHERCONFIGDIR"
|
||||
for f in "$OTHERCONFIGDIR"/*.conf; do
|
||||
[ -f "$f" ] && cat "$f" >> "$CONFIGFILE"
|
||||
done
|
||||
|
||||
# Parse general and interface sections thanks to the "config_cb()"
|
||||
# callback. This allows to loop over all options without having to
|
||||
# know their name in advance.
|
||||
|
@ -201,13 +197,24 @@ start_service() {
|
|||
config_load babeld
|
||||
# Parse filters separately, since we know which options we expect
|
||||
config_foreach babel_filter filter
|
||||
|
||||
# Import dynamic config files
|
||||
for f in "$OTHERCONFIGDIR"/*.conf; do
|
||||
[ -f "$f" ] && cat "$f" >> "$CONFIGFILE"
|
||||
done
|
||||
|
||||
procd_open_instance
|
||||
# Using multiple config files is supported since babeld 1.5.1
|
||||
procd_set_param command /usr/sbin/babeld -I "" -c "$OTHERCONFIGFILE" -c "$CONFIGFILE"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param file "$OTHERCONFIGFILE" "$OTHERCONFIGDIR"/*.conf "$CONFIGFILE"
|
||||
procd_set_param respawn
|
||||
|
||||
### Respawn automatically when process dies, after waiting respawn_timeout seconds
|
||||
### If respawn_retry consecutives respawns die before respawn_threshold seconds (i.e. they crash)
|
||||
### it will stop trying and leave it dead.
|
||||
procd_set_param respawn ${respawn_threshold:-60} ${respawn_timeout:-3} ${respawn_retry:-5}
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue