[erlang-questions] init.d script and a control script for starting an erlang app on boot in ubuntu

Pablo Platt pablo.platt@REDACTED
Thu Nov 19 19:00:16 CET 2009

From: Matt Stancliff <sysop@REDACTED>
To: Pablo Platt <pablo.platt@REDACTED>
Cc: erlang-questions@REDACTED
Sent: Mon, November 16, 2009 8:55:38 AM
Subject: Re: [erlang-questions] init.d script and a control script for starting an erlang app on boot in ubuntu


On Nov 15, 2009, at 9:55 PM, Pablo Platt wrote:
> Can someone post a simple init.d script with a control script for an erlang application on ubuntu?
> I'll appreciate an example for a control script that can start/stop/status/restart/reload(hot code update)/debug(attach an erlang shell).
> The script should also be able to restart the app (heart?).
>  The best setup I've found for node scripting is from rabbitmq:
 >   Control script: http://hg.rabbitmq.com/rabbitmq-server/file/default/scripts/rabbitmqctl
  >  Control module: http://hg.rabbitmq.com/rabbitmq-server/file/default/src/rabbit_control.erl

I've tried to see how rabbitmq works and I'm a bit confused.
The /etc/init.d/rabbitmq-server file define DAEMON=/usr/sbin/rabbitmq-multi and call
$DAEMON start_all ${NODE_COUNT} > /var/log/rabbitmq/startup_log 2> /var/log/rabbitmq/startup_err

/usr/sbin/rabbitmq-multi define SCRIPT=`basename $0` and call /usr/lib/bin/rabbitmq-multi:
surabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/${SCRIPT} ${CMDLINE}"

/usr/lib/bin/rabbitmq-multi starts the rabbitmq server by calling to rabbit_multi module start_all:
exec ... -s rabbit_multi ...

The rabbit_multi module create starts the nodes and create the pid files.

I didn't see a use of the files you link to rabbitmqctl and rabbit_control in the boot process.
They are probably being used to control the server after boot.

1. Does it have to be so complicated? 
For example, why does /usr/sbin/rabbitmq-multi calls /usr/lib/bin/rabbitmq-multi instead of starting the server?
Do I need to create and use pid files?

2. Does anyone have a simple boot script + control script that can be used with a mochiweb app?



More information about the erlang-questions mailing list