mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-18 23:36:39 +01:00
Moved reopening of log to SIGUSR1 (16)
Added --pidfile option to init.d script
This commit is contained in:
parent
2d46cb072e
commit
f722b3e9cb
2 changed files with 19 additions and 15 deletions
|
@ -21,10 +21,13 @@ void handle_signal(int sig)
|
||||||
switch (sig)
|
switch (sig)
|
||||||
{
|
{
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
LogPrint(eLogInfo, "Daemon: Got SIGHUP, reopening logs and tunnel configuration...");
|
LogPrint(eLogInfo, "Daemon: Got SIGHUP, reopening tunnel configuration...");
|
||||||
i2p::log::Logger().Reopen ();
|
|
||||||
i2p::client::context.ReloadConfig();
|
i2p::client::context.ReloadConfig();
|
||||||
break;
|
break;
|
||||||
|
case SIGUSR1:
|
||||||
|
LogPrint(eLogInfo, "Daemon: Got SIGUSR1, reopening logs...");
|
||||||
|
i2p::log::Logger().Reopen ();
|
||||||
|
break;
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
if (i2p::context.AcceptsTunnels () && !Daemon.gracefulShutdownInterval)
|
if (i2p::context.AcceptsTunnels () && !Daemon.gracefulShutdownInterval)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +80,7 @@ namespace i2p
|
||||||
}
|
}
|
||||||
|
|
||||||
// point std{in,out,err} descriptors to /dev/null
|
// point std{in,out,err} descriptors to /dev/null
|
||||||
freopen("/dev/null", "r", stdin);
|
freopen("/dev/null", "r", stdin);
|
||||||
freopen("/dev/null", "w", stdout);
|
freopen("/dev/null", "w", stdout);
|
||||||
freopen("/dev/null", "w", stderr);
|
freopen("/dev/null", "w", stderr);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +105,7 @@ namespace i2p
|
||||||
uint32_t cfsize; i2p::config::GetOption("limits.coresize", cfsize);
|
uint32_t cfsize; i2p::config::GetOption("limits.coresize", cfsize);
|
||||||
if (cfsize) // core file size set
|
if (cfsize) // core file size set
|
||||||
{
|
{
|
||||||
cfsize *= 1024;
|
cfsize *= 1024;
|
||||||
getrlimit(RLIMIT_CORE, &limit);
|
getrlimit(RLIMIT_CORE, &limit);
|
||||||
if (cfsize <= limit.rlim_max) {
|
if (cfsize <= limit.rlim_max) {
|
||||||
limit.rlim_cur = cfsize;
|
limit.rlim_cur = cfsize;
|
||||||
|
@ -153,6 +156,7 @@ namespace i2p
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = SA_RESTART;
|
sa.sa_flags = SA_RESTART;
|
||||||
sigaction(SIGHUP, &sa, 0);
|
sigaction(SIGHUP, &sa, 0);
|
||||||
|
sigaction(SIGUSR1, &sa, 0);
|
||||||
sigaction(SIGABRT, &sa, 0);
|
sigaction(SIGABRT, &sa, 0);
|
||||||
sigaction(SIGTERM, &sa, 0);
|
sigaction(SIGTERM, &sa, 0);
|
||||||
sigaction(SIGINT, &sa, 0);
|
sigaction(SIGINT, &sa, 0);
|
||||||
|
|
2
debian/i2pd.init
vendored
2
debian/i2pd.init
vendored
|
@ -53,7 +53,7 @@ do_start()
|
||||||
|| return 1
|
|| return 1
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --chuid "$USER" -- \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --chuid "$USER" -- \
|
||||||
--service --daemon --log=file --logfile=$LOGFILE --conf=$I2PCONF --tunconf=$TUNCONF \
|
--service --daemon --log=file --logfile=$LOGFILE --conf=$I2PCONF --tunconf=$TUNCONF \
|
||||||
$DAEMON_OPTS > /dev/null 2>&1 \
|
--pidfile=$PIDFILE $DAEMON_OPTS > /dev/null 2>&1 \
|
||||||
|| return 2
|
|| return 2
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue