comparison src/goodjava/lucene/backup/Backup.java @ 1674:af18eacf187c

automatic restore
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 29 May 2022 23:38:34 -0600
parents 1b9f9fdb3b41
children ea7075b7afe1
comparison
equal deleted inserted replaced
1673:1b9f9fdb3b41 1674:af18eacf187c
126 } 126 }
127 127
128 void handleZip(RpcServer rpc) throws IOException { 128 void handleZip(RpcServer rpc) throws IOException {
129 File zip = File.createTempFile("luan_",".zip"); 129 File zip = File.createTempFile("luan_",".zip");
130 IoUtils.delete(zip); 130 IoUtils.delete(zip);
131 String cmd = "zip -r " + zip + " " + dir.getName(); 131 String cmd = "zip " + zip + " *";
132 synchronized(this) { 132 synchronized(this) {
133 Process proc = Runtime.getRuntime().exec(cmd,null,dir.getParentFile()); 133 Process proc = Runtime.getRuntime().exec(new String[]{"bash","-c",cmd},null,dir);
134 IoUtils.waitFor(proc); 134 IoUtils.waitFor(proc);
135 } 135 }
136 InputStream in = new BufferedInputStream(new FileInputStream(zip)); 136 InputStream in = new BufferedInputStream(new FileInputStream(zip));
137 RpcResult result = new RpcResult(in,zip.length(),new Object[0]); 137 RpcResult result = new RpcResult(in,zip.length(),new Object[0]);
138 rpc.write(result); 138 rpc.write(result);