NetRunner.Daemon (NetRunner v1.2.1)

Copy Markdown View Source

A supervised long-running OS process.

Wraps NetRunner.Process for integration into a supervision tree. Automatically drains stdout/stderr to prevent pipe blocking.

Usage

# In your supervision tree:
children = [
  {NetRunner.Daemon, cmd: "redis-server", args: ["--port", "6380"], name: MyApp.Redis}
]

# Or start manually:
{:ok, pid} = NetRunner.Daemon.start_link(cmd: "tail", args: ["-f", "/var/log/syslog"],
                                          on_output: :log)

# Interact:
NetRunner.Daemon.os_pid(pid)
NetRunner.Daemon.alive?(pid)
NetRunner.Daemon.write(pid, "input\n")

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

on_output()

@type on_output() :: :discard | :log | (binary() -> any())

Functions

alive?(daemon)

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

os_pid(daemon)

start_link(opts)

write(daemon, data)