Project

General

Profile

« Previous | Next » 

Revision 8361

set registry permissions when configuring the exploded war on *nix systems. https://projects.ecoinformatics.org/ecoinfo/issues/4690

View differences:

src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java
34 34
import javax.servlet.http.HttpServletResponse;
35 35

  
36 36
import org.apache.commons.io.FileUtils;
37
import org.apache.commons.io.IOUtils;
37 38
import org.apache.commons.io.filefilter.DirectoryFileFilter;
38 39
import org.apache.commons.io.filefilter.OrFileFilter;
39 40
import org.apache.commons.io.filefilter.WildcardFileFilter;
......
50 51
import edu.ucsb.nceas.utilities.FileUtil;
51 52
import edu.ucsb.nceas.utilities.GeneralPropertyException;
52 53
import edu.ucsb.nceas.utilities.PropertiesMetaData;
53
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
54 54
import edu.ucsb.nceas.utilities.SortedProperties;
55 55
import edu.ucsb.nceas.utilities.UtilException;
56 56

  
......
299 299
				// make sure hazelcast.xml uses a unique group name
300 300
				this.modifyHazelcastConfig();
301 301
				
302
				// set permissions on the registry cgi scripts, least on *nix systems
303
				try {
304
					String cgiFiles = 
305
							PropertyService.getProperty("application.deployDir") 
306
							+ FileUtil.getFS() 
307
							+ PropertyService.getProperty("application.context") 
308
							+ PropertyService.getProperty("application.cgiDir")
309
							+ FileUtil.getFS() 
310
							+ "*.cgi";
311
					String [] command = {"sh", "-c", "chmod +x " + cgiFiles};
312
					Runtime rt = Runtime.getRuntime();
313
					Process pr = rt.exec(command);
314
					int ret = pr.waitFor();
315
					if (ret > 0) {
316
						logMetacat.error(IOUtils.toString(pr.getErrorStream()));
317
					}
318
				} catch (Exception ignorable) {
319
					/// just a warning
320
					logMetacat.warn("Could not set permissions on the registry scripts: " + ignorable.getMessage(), ignorable);
321
				}
322
				
302 323
				// write the backup properties to a location outside the 
303 324
				// application directories so they will be available after
304 325
				// the next upgrade

Also available in: Unified diff