- From: Indra k <
>
- To: "
" <
>
- Subject: [chef] multiple commands through ssh
- Date: Thu, 31 Jul 2014 14:39:30 +0800
Hi,
i need to run multiple commands in a remote machine through ssh,but when i use change directory it doesnot works and defaultly save in a root and also copy command is not working:
here is my code:
#!/usr/bin/ruby
require 'net/ssh'
#require 'mysql'
require 'rubygems'
ruby_block "Transfer bits" do
block do
HOST = node['trans']['host']
USER = node['trans']['username']
PASSWORD = "#{node['trans']['password']}"
Net::SSH.start( HOST, USER,
:password => PASSWORD )do |ssh|
ssh.exec("mysqldump -u#{node['trans']['login_user']} -p#{node['trans']['login_password']} magento > magentodb.sql; mysql -u#{node['trans']['login_user']} -p#{node['trans']['login_password']}bitnami_wordpress > wordpressdb.sql; mkdir Magentobits_V2; mv magentodb.sql Magentobits_V2; mv wordpressdb.sql Magentobits_V2; cp wordpress Magentobits_V2; tar cvzf Magentobits_V2.tar.gz /var/www/")
end
end
end
Anybody ve idea in this or open3 connection in ssh ?
Thanks,
Indra
- [chef] multiple commands through ssh, Indra k, 07/30/2014
Archive powered by MHonArc 2.6.16.