There are two config options in /etc/conf.d/asterisk that the init script doesn't honor unless ASTERISK_WRAPPER_SCRIPT is set to yes. These options in particular is ASTERISK_MAX_FD and ASTERISK_NICE. The following lines (copied from the loop code) should either be moved into the start() function, or duplicated for the non-wrapper case. if [ -n "${ASTERISK_MAX_FD}" ]; then ulimit -n ${ASTERISK_MAX_FD} echo " Max open filedescriptors : ${ASTERISK_MAX_FD}" fi if [ -n "${ASTERISK_NICE}" ]; then echo " Nice level : ${ASTERISK_NICE}" NICE="nice -n ${ASTERISK_NICE} --" fi Reproducible: Always
Tony, As per discussion, I'm about to add a new init.d script that removes the non-wrapper loop. Other enhancements includes improved startup output (it turns out the wrapper loop still outputted to the controlling tty after being backgrounded. Automatically pass -g to asterisk if ASTERISK_CORE_SIZE is set. Merge two variants of ASTERISK_NICE handling to use the nice command seeing that --niceness isn't exaclty a legal asterisk option as far as I can tell, however, the error checking there was better. Filter out -F too (explicit background) as with the wrapper that is a very, very bad idea. Will issue a warning if asterisk is started as root. ASTERISK_RESTART_DELAY will control how long the loop waits before restarting asterisk. Defaults to 5 seconds. Use asterisk -rx "module reload" instead of asterisk -rx "reload" as the reload actually comes from a cli alias which a user might configure away. Hope I didn't re-introduce bashisms into the script, although, there are a few places that I would have loved to use bash-specific constructs.
Created attachment 283701 [details] asterisk-initd
Created attachment 283703 [details] asterisk-confd
+*asterisk-1.8.6.0 (01 Sep 2011) + + 01 Sep 2011; Tony Vroon <chainsaw@gentoo.org> +files/1.8.0/asterisk.confd, + +files/1.8.0/asterisk.initd, +asterisk-1.8.6.0.ebuild: + Version bump. New & improved init script by Jaco Kroon closes bug #363267. + EAPI 4 porting by Agostino "ago" Sarubbo closes bug #380359.