From 08cc5b180eb7fd573326eb538a212b4c5d54e866 Mon Sep 17 00:00:00 2001 From: Tyler Karaszewski Date: Wed, 5 Jun 2024 15:51:50 -0700 Subject: [PATCH] Save logline at shutdown --- main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.cpp b/main.cpp index b8eacd917..c4f3354e8 100644 --- a/main.cpp +++ b/main.cpp @@ -4,6 +4,7 @@ /// #include #include +#include #include #include #include @@ -399,5 +400,14 @@ int main(int argc, char* argv[]) { // All done SINFO("Graceful process shutdown complete"); + + // Save that we're shutting down. + pid_t pid = getpid(); + ofstream file("/var/log/bedrock_shutdown", std::ios::app); + if (file) { + file << "shutdown " << pid << " " << SComposeTime("%Y-%m-%dT%H:%M:%S", STimeNow()) << endl; + file.close(); + } + return 0; }