[packages/ejabberd] - rel 3; run all command via daemon(), so limits gets applied correctly and we don't hit: File opera

Elan Ruusamäe glen at pld-linux.org
Thu May 8 09:47:25 CEST 2014

On 07.05.2014 00:27, arekm wrote:
>   stop() {
>   	# Stop daemons.
>   	if [ -f /var/lock/subsys/ejabberd ]; then
> -		msg_stopping ejabberd ; busy
> -		/usr/sbin/ejabberdctl stop 2>/dev/null
> +		msg_stopping ejabberd
> +		daemon /usr/sbin/ejabberdctl stop
>   		RETVAL=$?
no, no... no!

daemon() is for starting processes
you can't use daemon() to stop processes, as it's internal logic expects 
process to START, but if your action STOPS the action will fail. i.e its 
checking for pid file to appear and proper pid written there.

if you need to exec stuff like daemon() does, use `run_command "title" 
command args` instead

# Usage:
# run_cmd Message command_to_run
# run_cmd -a Message command_to_run
# run_cmd --user "username" "Message" command_to_run

note: don't use anything complex there (create separate wrapper if need 
complex args), as quoting depends whether $RC_LOGGING is ON or OFF.


More information about the pld-devel-en mailing list