Skip to content

Commit

Permalink
Save logline at shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerkaraszewski committed Jun 5, 2024
1 parent db1d5be commit 08cc5b1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
///
#include <dlfcn.h>
#include <iostream>
#include <fstream>
#include <signal.h>
#include <sys/resource.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -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;
}

0 comments on commit 08cc5b1

Please sign in to comment.