Merge 92dcbe9cc3 into merged_master (Bitcoin PR bitcoin/bitcoin#23395)

This commit is contained in:
Byron Hambly 2025-04-03 11:51:23 +02:00
commit bf8f8812bb
3 changed files with 34 additions and 1 deletions

View file

@ -199,8 +199,24 @@ static fs::path GetPidFile(const ArgsManager& args)
// shutdown thing.
//
#if HAVE_SYSTEM
static void ShutdownNotify(const ArgsManager& args)
{
std::vector<std::thread> threads;
for (const auto& cmd : args.GetArgs("-shutdownnotify")) {
threads.emplace_back(runCommand, cmd);
}
for (auto& t : threads) {
t.join();
}
}
#endif
void Interrupt(NodeContext& node)
{
#if HAVE_SYSTEM
ShutdownNotify(*node.args);
#endif
InterruptHTTPServer();
InterruptHTTPRPC();
InterruptRPC();
@ -453,6 +469,7 @@ void SetupServerArgs(ArgsManager& argsman)
argsman.AddArg("-settings=<file>", strprintf("Specify path to dynamic settings data file. Can be disabled with -nosettings. File is written at runtime and not meant to be edited by users (use %s instead for custom settings). Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME, BITCOIN_SETTINGS_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
#if HAVE_SYSTEM
argsman.AddArg("-startupnotify=<cmd>", "Execute command on startup.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
argsman.AddArg("-shutdownnotify=<cmd>", "Execute command immediately before beginning shutdown. The need for shutdown may be urgent, so be careful not to delay it long (if the command doesn't require interaction with the server, consider having it fork into the background).", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
#endif
#ifndef WIN32
argsman.AddArg("-sysperms", "Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);