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 who should own the server process.
group<String>:The group who should own the server process.

Alternatives

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

Parameters

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

Returns

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

Parameters

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

Parameters

port<~to_s>:The port of the Merb process to kill.
sig<~to_s>:The signal to send to the process. Defaults to 9.

Alternatives

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

Gets the pid file for the specified port.

Parameters

port<~to_s>:The port 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 value to the path.

Get a list of the pid files.

Returns

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

Removes a PID file used by the server from 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 based PID file.

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.

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 based PID file.

[Validate]