fix error

This commit is contained in:
邱博亞 2021-02-19 17:21:08 +08:00
parent 2a2ed90114
commit 9263290fee
1 changed files with 1 additions and 1 deletions

View File

@ -10,7 +10,7 @@ namespace :create_site do
@password = site_server.password
Net::SSH.start(site_server.ip , site_server.account , password: site_server.password) do |ssh|
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('$','\$')
nginx_file_content = nginx_file_content.gsub(/^[ \t]*server_name[ \t]+.*;/," server_name #{args.server_name};")
puts nginx_file_content
cmd = "x='#{nginx_file_content}'; echo '#{@password}' | sudo -S sh -c \"echo '$x' > #{site_construct.nginx_file}\""
exec_command_by_user(ssh,cmd)