Methods Summary |
---|
public static void | addExtraCommand(java.lang.String s)
String extraCmds = COConfigurationManager.getStringParameter(
"scriptaftershutdown", null);
if (extraCmds == null) {
extraCmds = s + "\n";
} else {
extraCmds += s + "\n";
}
COConfigurationManager.setParameter("scriptaftershutdown", extraCmds);
|
private static void | log(java.lang.String string)
sysout.println("echo \"" + string.replaceAll("\"", "\\\"") + "\"");
|
public static void | main(java.lang.String[] args)
// Since stdout will be in a shell script, redirect any stdout not coming
// from us to stderr
sysout = System.out;
try {
System.setOut(new PrintStream(new FileOutputStream("/dev/stderr")));
} catch (FileNotFoundException e) {
}
String extraCmds = COConfigurationManager.getStringParameter(
"scriptaftershutdown", null);
if (extraCmds != null) {
boolean exit = COConfigurationManager.getBooleanParameter(
"scriptaftershutdown.exit", false);
if (exit) {
COConfigurationManager.removeParameter("scriptaftershutdown.exit");
}
COConfigurationManager.removeParameter("scriptaftershutdown");
COConfigurationManager.save();
sysout.println(extraCmds);
if (exit) {
sysout.println("exit");
}
} else {
log("No shutdown tasks to do");
}
|
public static void | setRequiresExit(boolean requiresExit)
if (requiresExit) {
COConfigurationManager.setParameter("scriptaftershutdown.exit", true);
}
|