// Get system info
PrintStream syslog =
new PrintStream(new FileOutputStream(f));
Command sysinfo = new Command("sysinfo");
sysinfo.setStreamHandling(Command.STDOUT, Command.CAPTURE);
CommandHandle handle = cmds.execute(host, sysinfo, null);
byte[] info = handle.fetchOutput(Command.STDOUT);
// Write header and info to file.
syslog.println("<html><head><title>System Info for Server "
+ machineName + "</title></head><body>");
syslog.write(info);
// Get User Commands output if specified
if (hostConfig.userCommands != null &&
hostConfig.userCommands.trim().length() > 0) {
String[] cmdStrings = hostConfig.userCommands.
split(";");
for (String cmdString : cmdStrings) {
Command c = new Command(cmdString);
c.setStreamHandling(Command.STDOUT,Command.CAPTURE);
logger.info("Executing '" + cmdString + "'");
handle = cmds.execute(host, c, null);
info = handle.fetchOutput(Command.STDOUT);
if (info != null) {
syslog.println(linesep);
syslog.println("<h3>" + hostConfig.userCommands+
" on server " + machineName + "</h3>");
syslog.println("<pre>\n");