ruby-launch-agent

A library to use launchd easily

Synopsis

require 'launch_agent'

agent = LaunchAgent::Daemon.new('ruby', '/path/to/foo.rb', 'arg1', 'arg2')

# load
agent.load

# unload
agent.unload

CLI

% launchagent -h
Usage:
  launchagent [--env=<env>] (--daemon | --interval <sec>) [--wdir=<dir>] [--stdout=<path>] [--stderr=<path>] (<argument>...)
  launchagent -h | --help

Options:
  -h --help              Show this screen.
  -v --version           Show version information.
  -e --env=<env>         Additional environmental variables to be set before running the job. Can specify multiple value with comma. e.g. FOO=bar,BAR=baz
  -w --wdir=<dir>        Specify a directory to chdir(2) to before running the job
  -d --daemon            Load as daemon. If it is set, --interval option is ignored
  -i --interval=<sec>    Causes the job to be started every N seconds
  -o --stdout=<path>     Specify what file should be used for data being sent to stdout when using stdio(3)
  -r --stderr=<path>     Specify what file should be used for data being sent to stderr when using stdio(3)

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 youpy. See LICENSE for details.