Module: TorqueBox::Launchd Private
- Defined in:
- lib/torquebox/launchd.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .check_install ⇒ Object private
- .install ⇒ Object private
- .log_dir ⇒ Object private
- .plist_dir ⇒ Object private
- .plist_file ⇒ Object private
- .plist_template ⇒ Object private
Class Method Details
.check_install ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/torquebox/launchd.rb', line 43 def check_install raise "#{plist_file} not installed in #{plist_dir}" unless ( File.exist?( plist_file ) ) puts "TorqueBox plist scripts OK: #{plist_file}." launchctl_found = false; IO.popen( 'launchctl list | grep torquebox' ) do |output| output.each do |line| if line =~ /torquebox/ puts "TorqueBox launchd script OK: #{line}" launchctl_found = true break end end end raise "TorqueBox launchd script not found in launchctl." unless launchctl_found end |
.install ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/torquebox/launchd.rb', line 61 def install unless File.writable?( plist_dir ) raise "Cannot write launchd configuration to #{plist_dir}. You'll need to copy #{plist_file} to #{plist_dir} yourself." end File.delete( plist_file ) if File.exists? plist_file lines = File.open( plist_template, 'r' ) { |f| f.readlines } File.open( plist_file, 'w' ) do |file| lines.each do |line| if line =~ /\$\{TORQUEBOX_HOME\}/ file.puts( line.sub( /\$\{TORQUEBOX_HOME\}/, TorqueBox::DeployUtils.torquebox_home ) ) else file.puts line end end end puts "Created launchd plist #{plist_file}, loading now." TorqueBox::DeployUtils.run_command "launchctl load #{plist_file}" check_install FileUtils.mkdir_p log_dir, :mode => 0755 unless File.exists? log_dir end |
.log_dir ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/torquebox/launchd.rb', line 27 def log_dir File.join( TorqueBox::DeployUtils.jboss_home, 'standalone', 'logs' ) end |
.plist_dir ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/torquebox/launchd.rb', line 39 def plist_dir File.join( TorqueBox::DeployUtils.torquebox_home, 'share', 'init' ) end |
.plist_file ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 |
# File 'lib/torquebox/launchd.rb', line 35 def plist_file File.join( plist_dir, 'TorqueBoxAgent.plist' ) end |
.plist_template ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/torquebox/launchd.rb', line 31 def plist_template File.join( plist_dir, 'TorqueBoxAgent.plist.template' ) end |