Feature: allow the client to shut down the computer at or after a certain time (#249)
A new -shutdown <time> option has been created to specify the time when the client will stop asking for new jobs, will finish uploading the frames in the upload queue and will shutdown the computer. The time argument can have two different formats: an absolute date & time in the format yyyy-MM-ddThh:mm:ss (24h format) or a relative time in the format +m where m is the number of minutes from now. The user can also select the shutdown-mode, where "wait" will wait for all the processes (render + pending uploads) to finish and "hard" will cancel all the pending jobs and will initiate the computer shutdown.
This commit is contained in:
@@ -214,4 +214,15 @@ public class Mac extends OS {
|
||||
}
|
||||
return hasNiceBinary;
|
||||
}
|
||||
|
||||
@Override public void shutdownComputer(int delayInMinutes) {
|
||||
try {
|
||||
// Shutdown the computer waiting 1 minute to allow all SheepIt threads to close and exit the app
|
||||
ProcessBuilder builder = new ProcessBuilder("shutdown", "-h", String.valueOf(delayInMinutes));
|
||||
Process process = builder.inheritIO().start();
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.err.println(String.format("Mac::shutdownComputer Unable to execute the 'shutdown -h 1' command. Exception %s", e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user