mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
fix Linux Daemon
This commit is contained in:
parent
0b210ee99d
commit
e674014efc
3 changed files with 16 additions and 7 deletions
|
@ -6,6 +6,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
//#include <boost/filesystem.hpp>
|
||||
#include "util.h"
|
||||
|
||||
|
||||
void handle_signal(int sig)
|
||||
{
|
||||
switch (sig)
|
||||
|
@ -26,7 +30,7 @@ void handle_signal(int sig)
|
|||
case SIGABRT:
|
||||
case SIGTERM:
|
||||
case SIGINT:
|
||||
running = 0; // Exit loop
|
||||
Daemon.running = 0; // Exit loop
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -63,9 +67,9 @@ namespace i2p
|
|||
}
|
||||
|
||||
// Pidfile
|
||||
std::string pidfile = i2p::util::filesystem::GetDataDir().string();
|
||||
pidfile = i2p::util::filesystem::GetDataDir().string();
|
||||
pidfile.append("/i2pd.pid");
|
||||
int pidFilehandle = open(pidfile.c_str(), O_RDWR | O_CREAT, 0600);
|
||||
pidFilehandle = open(pidfile.c_str(), O_RDWR | O_CREAT, 0600);
|
||||
if (pidFilehandle == -1)
|
||||
{
|
||||
LogPrint("Error, could not create pid file (", pidfile, ")\nIs an instance already running?");
|
||||
|
@ -90,7 +94,7 @@ namespace i2p
|
|||
sigaction(SIGTERM, &sa, 0);
|
||||
sigaction(SIGINT, &sa, 0);
|
||||
|
||||
retunrn Daemon_Singleton::start();
|
||||
return Daemon_Singleton::start();
|
||||
}
|
||||
|
||||
bool DaemonLinux::stop()
|
||||
|
@ -106,4 +110,4 @@ namespace i2p
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue