Skip to content

Commit

Permalink
Low: asterisk: improve directory creation on start
Browse files Browse the repository at this point in the history
- Wrap the install(8) invocation in ocf_run so we get a useful log
  message on error.
- Exit if we fail to create a required directory.
- Remove superfluous mkdir/chown block.
  • Loading branch information
fghaas committed Nov 10, 2011
1 parent cf130ce commit 80ea432
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions heartbeat/asterisk
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,15 @@ asterisk_start() {
fi

for i in $ASTRUNDIR $ASTLOGDIR $ASTLOGDIR/cdr-csv $ASTLOGDIR/cdr-custom; do
[ -d $dir ] || install -d -o $OCF_RESKEY_user -g $OCF_RESKEY_group $i
if [ ! -d "$i" ]; then
ocf_run install -d -o $OCF_RESKEY_user -g $OCF_RESKEY_group $i \
|| exit $OCF_ERR_GENERIC
fi
done

# set MAXFILES
ulimit -n $OCF_RESKEY_maxfiles

if [ ! -d $ASTRUNDIR ] ; then
ocf_log info "Creating PID dir: $ASTRUNDIR"
mkdir -p $ASTRUNDIR
chown $OCF_RESKEY_user:$OCF_RESKEY_group $ASTRUNDIR
fi

# Determine whether Asterisk PBX is supposed to run in Realtime mode
# or not and make asterisk daemonize automatically
local asterisk_extra_params
Expand Down

0 comments on commit 80ea432

Please sign in to comment.