Module: C3D::TransmissionRunner
- Extended by:
- TransmissionRunner
- Included in:
- TransmissionRunner
- Defined in:
- lib/c3d/util/processes.rb
Instance Method Summary collapse
Instance Method Details
#is_trans_running?(cli) ⇒ Boolean
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/c3d/util/processes.rb', line 14 def is_trans_running? cli a = `ps aux`.split("\n").select{|e| e[/transmission-daemon/]} if ! a.empty? if cli print "Please stop your default Transmission Server with `sudo service transmission-daemon stop` and then restart.\n" print "Would you like to override this message and start c3d anyway? (Y/n)\n" override = STDIN.gets.chomp if override == 'Y' || override == 'y' return true else exit 0 end else return true end end return (! a.empty?) end |
#start_transmission(cli) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/c3d/util/processes.rb', line 6 def start_transmission cli unless is_trans_running? cli pid = spawn "transmission-daemon -f --no-incomplete-dir -o -C -p #{ENV['TORRENT_RPC'].split(':').last[0..3]} -w #{ENV['BLOBS_DIR']} -g #{File.join(ENV['HOME'], '.epm')}" sleep 3 at_exit { Process.kill("INT", pid) } end end |