muontrap v0.4.2 MuonTrap.Daemon View Source

Wrap an OS process in a GenServer so that it can be supervised.

For example, in your children list add MuonTrap.Daemon like this:

children = [
  {MuonTrap.Daemon, ["myserver", ["--options", "foo")], [cd: "/somedirectory"]]}
]

opts = [strategy: :one_for_one, name: MyApplication.Supervisor]
Supervisor.start_link(children, opts)

The same options as MuonTrap.cmd/3 are available with the following additions:

  • :log_output - When set, send output from the command to the Logger. Specify the log level (e.g., :debug)
  • :stderr_to_stdout - When set to true, redirect stderr to stdout. Defaults to false.

Link to this section Summary

Functions

Get the value of the specified cgroup variable.

Returns a specification to start this module under a supervisor.

Return the OS pid to the muontrap executable.

Start/link a deamon GenServer for the specified command.

Link to this section Functions

Link to this function

cgget(server, controller, variable_name) View Source
cgget(GenServer.server(), binary(), binary()) :: binary()

Get the value of the specified cgroup variable.

Link to this function

cgset(server, controller, variable_name, value) View Source
cgset(GenServer.server(), binary(), binary(), binary()) :: :ok | no_return()

Modify a cgroup variable.

Returns a specification to start this module under a supervisor.

See Supervisor.

Return the OS pid to the muontrap executable.

Link to this function

start_link(command, args, opts \\ []) View Source
start_link(binary(), [binary()], keyword()) :: GenServer.on_start()

Start/link a deamon GenServer for the specified command.