fix error for changing server name
This commit is contained in:
parent
cb7deed4ac
commit
2a2ed90114
|
@ -12,8 +12,8 @@ namespace :create_site do
|
|||
nginx_file_content = exec_command_by_user(ssh,"cat #{site_construct.nginx_file}")
|
||||
nginx_file_content = nginx_file_content.gsub(/^[ \t]*server_name[ \t]+.*;/," server_name #{args.server_name};").gsub('$','\$')
|
||||
puts nginx_file_content
|
||||
cmd = "sh -c \"echo '#{nginx_file_content}' > #{site_construct.nginx_file}\""
|
||||
exec_ssh_command_by_sudo(ssh,cmd)
|
||||
cmd = "x='#{nginx_file_content}'; echo '#{@password}' | sudo -S sh -c \"echo '$x' > #{site_construct.nginx_file}\""
|
||||
exec_command_by_user(ssh,cmd)
|
||||
exec_ssh_command_by_sudo(ssh,"service nginx restart")
|
||||
end
|
||||
site_construct.update_attributes(domain_name: args.server_name)
|
||||
|
|
Loading…
Reference in New Issue