Sha256: ff39e70b8bb5728023024b67391b8f858138811653de2d2f45e02624e3a961eb
Contents?: true
Size: 820 Bytes
Versions: 2
Compression:
Stored size: 820 Bytes
Contents
#!/usr/bin/env ruby require 'git-style-binary/command' GitStyleBinary.command do short_desc "load/unload a daemon-like agent" banner <<-EOS Usage: #{command.full_name} #{all_options_string} {full command} Load/Unload a daemon-like launchd agent EOS opt :env, "additional environmental variables to be set before running the job. can specify multiple times", :type => String, :multi => true run do |command| abort 'full command must be supplised' if command.argv.empty? agent = LaunchAgent::Daemon.new(*command.argv) agent['EnvironmentVariables'] = command.opts[:env].inject({}) do |memo, env| k, v = env.split('=') memo[k] = v memo end action = agent.loaded? ? :unload : :load agent.send(action) puts '%s "%s"' % [action, command.argv.join(' ')] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
launch-agent-0.3.0 | bin/launchagent-daemon |
launch-agent-0.2.0 | bin/launchagent-daemon |