Skip to content

Instantly share code, notes, and snippets.

@bararchy
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bararchy/78bcb57d9c3175461569 to your computer and use it in GitHub Desktop.
Save bararchy/78bcb57d9c3175461569 to your computer and use it in GitHub Desktop.
Testing
Process.spawn do
Dir.mktmpdir do |temp_dir|
driver = Driver.new(temp_dir)
%x(sudo mv backup* #{temp_dir})
print "\nDone, the backup archive has been created at #{temp_dir}/backup#{Time.now.strftime('%Y%m%d-%H%M')}.tar.gz"
server = Ftpd::FtpServer.new(driver)
get_ip
server.interface = @localip
server.start
puts "\nFTP server listening on port #{server.bound_port}, Press enter to close the FTP server\n"
gets
ftpid = Process.pid
%x(sudo kill -2 #{ftpid})
exit 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment