mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
Merge pull request #105 from CameronNemo/daemon
Various init script and daemonization fixups
This commit is contained in:
commit
51b2b5676c
13
Daemon.cpp
13
Daemon.cpp
@ -84,18 +84,13 @@ namespace i2p
|
||||
// initialize log
|
||||
if (isLogging)
|
||||
{
|
||||
if (isDaemon)
|
||||
{
|
||||
std::string logfile_path = IsService () ? "/var/log" : i2p::util::filesystem::GetDataDir().string();
|
||||
std::string logfile_path = IsService () ? "/var/log" : i2p::util::filesystem::GetDataDir().string();
|
||||
#ifndef _WIN32
|
||||
logfile_path.append("/i2pd.log");
|
||||
logfile_path.append("/i2pd.log");
|
||||
#else
|
||||
logfile_path.append("\\i2pd.log");
|
||||
logfile_path.append("\\i2pd.log");
|
||||
#endif
|
||||
StartLog (logfile_path);
|
||||
}
|
||||
else
|
||||
StartLog (""); // write to stdout
|
||||
StartLog (logfile_path);
|
||||
}
|
||||
|
||||
d.httpServer = new i2p::util::HTTPServer(i2p::util::config::GetArg("-httpport", 7070));
|
||||
|
22
debian/init.d → debian/i2pd.init
vendored
22
debian/init.d → debian/i2pd.init
vendored
@ -57,10 +57,10 @@ do_stop()
|
||||
}
|
||||
|
||||
# Function that sends a SIGHUP to the daemon/service
|
||||
#do_reload() {
|
||||
# start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
||||
# return 0
|
||||
#}
|
||||
do_reload() {
|
||||
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
@ -82,14 +82,12 @@ case "$1" in
|
||||
status)
|
||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
#reload|force-reload)
|
||||
#log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
#do_reload
|
||||
#log_end_msg $?
|
||||
#;;
|
||||
restart|force-reload)
|
||||
# If the "reload" option is implemented then remove the
|
||||
# 'force-reload' alias
|
||||
reload|force-reload)
|
||||
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
do_reload
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart)
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
10
debian/i2pd.upstart
vendored
Normal file
10
debian/i2pd.upstart
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
description "i2p client daemon"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [016] or unmounting-filesystem
|
||||
|
||||
# these can be overridden in /etc/init/i2pd.override
|
||||
env I2P_HOST="1.2.3.4"
|
||||
env I2P_PORT="4567"
|
||||
|
||||
exec /usr/sbin/i2pd --daemon=0 --log=1 --host=$I2P_HOST --port=$I2P_PORT
|
Loading…
Reference in New Issue
Block a user