Class: DRbQS::Manage::SSHExecute
- Inherits:
-
Object
- Object
- DRbQS::Manage::SSHExecute
- Defined in:
- lib/drbqs/manage/ssh_execute.rb
Constant Summary collapse
- COMMAND_NICE =
"nice"
- COMMAND_DRBQS_SERVER =
"drbqs-server"
- COMMAND_DRBQS_NODE =
"drbqs-node"
- COMMAND_FILENAME_CREATE =
"filename-create"
Instance Method Summary collapse
- #command(command) ⇒ Object
- #get_environment ⇒ Object
-
#initialize(dest, opts = {}) ⇒ SSHExecute
constructor
A new instance of SSHExecute.
-
#node(cmd_options, opts = {}) ⇒ Object
Add options --daemon and --log-prefix.
-
#server(cmd_options, opts = {}) ⇒ Object
Add options --daemon and --log-file.
Constructor Details
#initialize(dest, opts = {}) ⇒ SSHExecute
Returns a new instance of SSHExecute.
21 22 23 24 25 26 27 28 |
# File 'lib/drbqs/manage/ssh_execute.rb', line 21 def initialize(dest, opts = {}) @ssh_host = DRbQS::Config.new.ssh_host opts = opts.dup path, = @ssh_host.(dest) dest = .delete(:dest) || dest @bundler = opts.delete(:bundler) @ssh_shell = DRbQS::Manage::SSHShell.new(dest, .merge(opts)) end |
Instance Method Details
#command(command) ⇒ Object
30 31 32 |
# File 'lib/drbqs/manage/ssh_execute.rb', line 30 def command(command) @ssh_shell.execute_all(command) end |
#get_environment ⇒ Object
34 35 36 |
# File 'lib/drbqs/manage/ssh_execute.rb', line 34 def get_environment @ssh_shell.get_environment end |
#node(cmd_options, opts = {}) ⇒ Object
Add options --daemon and --log-prefix.
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/drbqs/manage/ssh_execute.rb', line 79 def node(, opts = {}) ret = nil @ssh_shell.start do |sh| dir = create_new_directory(sh, opts[:daemon] || 'drbqs_node_log') cmd = (command_ruby(COMMAND_DRBQS_NODE), File.join(dir, 'daemon_node.log'), opts[:nice]) cmd << ' --log-prefix ' << File.join(dir, 'node') << ' ' << .join(' ') process, result = sh.exec(cmd) ret = (process.exit_status == 0) end ret end |
#server(cmd_options, opts = {}) ⇒ Object
Add options --daemon and --log-file.
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/drbqs/manage/ssh_execute.rb', line 65 def server(, opts = {}) ret = nil @ssh_shell.start do |sh| dir = create_new_directory(sh, opts[:daemon] || 'drbqs_server_log') cmd = (command_ruby(COMMAND_DRBQS_SERVER), File.join(dir, 'daemon_server.log'), opts[:nice]) cmd << " --log-file " << File.join(dir, 'server.log') << ' ' cmd << .join(' ') process, result = sh.exec(cmd) ret = (process.exit_status == 0) end ret end |