Skip to content

Commit

Permalink
Update shutdown handling
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Sep 22, 2023
1 parent 90e9016 commit 7e5529d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cpp/piscsi/piscsi_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,21 +429,23 @@ bool PiscsiExecutor::ShutDown(const CommandContext& context, const string& mode)

context.WriteResult(result);

controller_manager.FlushCaches();
DetachAll();

if (system("init 0") == -1) {
LogErrno("System shutdown failed");
spdlog::error("System shutdown failed");
}
}
else if (mode == "reboot") {
spdlog::info("System reboot requested");

context.WriteResult(result);

controller_manager.FlushCaches();
DetachAll();

if (system("init 6") == -1) {
LogErrno("System reboot failed");
spdlog::error("System reboot failed");
}
}
else {
Expand Down

0 comments on commit 7e5529d

Please sign in to comment.