Skip to content

Instantly share code, notes, and snippets.

@youpy
Created August 5, 2011 09:31
Show Gist options
  • Save youpy/1127195 to your computer and use it in GitHub Desktop.
Save youpy/1127195 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
%w/rubygems launch_agent/.each {|g| require g }
def usage
print <<EOM
usage: #{$0} command [arg ...]
EOM
exit 1
end
usage if ARGV.empty?
agent = LaunchAgent::Daemon.new(*ARGV)
action = agent.loaded? ? :unload : :load
agent.send(action)
warn '%s "%s"' % [action, ARGV.join(' ')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment