From 66fb32d267d90fe2e1f652570bc45aba26be55fa Mon Sep 17 00:00:00 2001 From: gjs278 Date: Tue, 12 Apr 2011 19:15:19 -0500 Subject: pidfile support for daemon --- init.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'init.cpp') diff --git a/init.cpp b/init.cpp index effac288fc..dcfc6765b5 100644 --- a/init.cpp +++ b/init.cpp @@ -41,6 +41,7 @@ void Shutdown(void* parg) DBFlush(false); StopNode(); DBFlush(true); + boost::filesystem::remove(GetPidFile()); CreateThread(ExitTimeout, NULL); Sleep(50); printf("Bitcoin exiting\n\n"); @@ -151,6 +152,7 @@ bool AppInit2(int argc, char* argv[]) " bitcoin [options] help \t\t " + _("Get help for a command\n") + _("Options:\n") + " -conf= \t\t " + _("Specify configuration file (default: bitcoin.conf)\n") + + " -pid= \t\t " + _("Specify pid file (default: bitcoind.pid)\n") + " -gen \t\t " + _("Generate coins\n") + " -gen=0 \t\t " + _("Don't generate coins\n") + " -min \t\t " + _("Start minimized\n") + @@ -251,7 +253,10 @@ bool AppInit2(int argc, char* argv[]) return false; } if (pid > 0) + { + CreatePidFile(GetPidFile(), pid); return true; + } pid_t sid = setsid(); if (sid < 0) -- cgit v1.2.3