Skip to content

Instantly share code, notes, and snippets.

@indirect
Created August 10, 2010 21:01
Show Gist options
  • Save indirect/517993 to your computer and use it in GitHub Desktop.
Save indirect/517993 to your computer and use it in GitHub Desktop.
Launch SickBeard at startup
#!/usr/bin/env ruby
require 'fileutils'
`curl -s -O http://gist.github.com/raw/517993/e74c2d1c101a617201c0ded8880d9740faba588b/name.indirect.sickbeard.plist`
plist = File.read("name.indirect.sickbeard.plist")
File.open("name.indirect.sickbeard.plist", "w") do |f|
sb_path = File.exist?("Sick-Beard") ? File.join(Dir.pwd, "Sick-Beard") : Dir.pwd
f.write plist.gsub("/Users/andre/sw/Sick-Beard", sb_path)
end
FileUtils.cp("name.indirect.sickbeard.plist", File.expand_path("~/Library/LaunchAgents"))
`launchctl load ~/Library/LaunchAgents/name.indirect.sickbeard.plist`
`launchctl start name.indirect.sickbeard`
FileUtils.rm_rf("name.indirect.sickbeard.plist")
FileUtils.rm_rf(__FILE__)
puts "Okay, SickBeard should start when your machine boots now!"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>name.indirect.sickbeard</string>
<key>WorkingDirectory</key>
<string>/Users/andre/sw/Sick-Beard</string>
<key>ProgramArguments</key>
<array>
<string>python</string>
<string>SickBeard.py</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment