Class Merb::Server
In: lib/merb-core/server.rb
Parent: Object

Server encapsulates the management of Merb daemons.

Methods

Public Class methods

Change privileges of the process to the specified user and group.

Parameters

user<String>:The user to change the process to.
group<String>:The group to change the process to.

Alternatives

If group is left out, the user will be used as the group.

:api: private

Add trap to enter IRB on SIGINT. Process exit if second SIGINT is received.

:api: private

Parameters

port<~to_s>:The port to check for Merb instances on.

Returns

Boolean:True if Merb is running on the specified port.

:api: private

Starts up Merb by running the bootloader and starting the adapter.

:api: private

Change process user/group to those specified in Merb::Config.

:api: private

Parameters

port<~to_s>:The port of the Merb process to daemonize.

:api: private

Parameters

port<~to_s>:The port of the Merb process to kill.
sig<~to_s>:The signal to send to the process, the default is 9 - SIGKILL.

No Name Default Action Description 1 SIGHUP terminate process terminal line hangup 2 SIGINT terminate process interrupt program 3 SIGQUIT create core image quit program 4 SIGILL create core image illegal instruction 9 SIGKILL terminate process kill program 15 SIGTERM terminate process software termination signal 30 SIGUSR1 terminate process User defined signal 1 31 SIGUSR2 terminate process User defined signal 2

Alternatives

If you pass "all" as the port, the signal will be sent to all Merb processes.

:api: private

Sends the provided signal to the process pointed at by the provided pid file. :api: private

Gets the pid file for the specified port/socket.

Parameters

port<~to_s>:The port/socket of the Merb process to whom the the PID file belongs to.

Returns

String:Location of pid file for specified port. If clustered and pid_file option is specified, it adds the port/socket value to the path.

:api: private

Get a list of the pid files.

Returns

Array:List of pid file paths. If not running clustered, the array contains a single path.

:api: private

Delete the pidfile for the specified port/socket.

:api: private

Removes a PID file used by the server from the filesystem. This uses :pid_file options from configuration when provided or merb.<port/socket>.pid in log directory by default.

Parameters

port<~to_s>:The port of the Merb process to whom the the PID file belongs to.

Alternatives

If Merb::Config[:pid_file] has been specified, that will be used instead of the port/socket based PID file.

:api: private

Shut down Merb, reap any workers if necessary.

:api: private

Start a Merb server, in either foreground, daemonized or cluster mode.

Parameters

port<~to_i>:The port to which the first server instance should bind to. Subsequent server instances bind to the immediately following ports.
cluster<~to_i>:Number of servers to run in a cluster.

Alternatives

If cluster is left out, then one process will be started. This process will be daemonized if Merb::Config[:daemonize] is true.

:api: private

Stores a PID file on the filesystem. This uses :pid_file options from configuration when provided or merb.<port/socket>.pid in log directory by default.

Parameters

port<~to_s>:The port of the Merb process to whom the the PID file belongs to.

Alternatives

If Merb::Config[:pid_file] has been specified, that will be used instead of the port/socket based PID file.

:api: private

Stores a PID file on the filesystem. This uses :pid_file options from configuration when provided or merb.<port>.pid in log directory by default.

Parameters

port<~to_s>:The port of the Merb process to whom the the PID file belongs to.

Alternatives

If Merb::Config[:pid_file] has been specified, that will be used instead of the port/socket based PID file.

:api: private

[Validate]