mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-08 22:57:52 +00: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
|
// initialize log
|
||||||
if (isLogging)
|
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
|
#ifndef _WIN32
|
||||||
logfile_path.append("/i2pd.log");
|
logfile_path.append("/i2pd.log");
|
||||||
#else
|
#else
|
||||||
logfile_path.append("\\i2pd.log");
|
logfile_path.append("\\i2pd.log");
|
||||||
#endif
|
#endif
|
||||||
StartLog (logfile_path);
|
StartLog (logfile_path);
|
||||||
}
|
|
||||||
else
|
|
||||||
StartLog (""); // write to stdout
|
|
||||||
}
|
}
|
||||||
|
|
||||||
d.httpServer = new i2p::util::HTTPServer(i2p::util::config::GetArg("-httpport", 7070));
|
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
|
# Function that sends a SIGHUP to the daemon/service
|
||||||
#do_reload() {
|
do_reload() {
|
||||||
# start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
||||||
# return 0
|
return 0
|
||||||
#}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
@ -82,14 +82,12 @@ case "$1" in
|
|||||||
status)
|
status)
|
||||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
;;
|
;;
|
||||||
#reload|force-reload)
|
reload|force-reload)
|
||||||
#log_daemon_msg "Reloading $DESC" "$NAME"
|
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||||
#do_reload
|
do_reload
|
||||||
#log_end_msg $?
|
log_end_msg $?
|
||||||
#;;
|
;;
|
||||||
restart|force-reload)
|
restart)
|
||||||
# If the "reload" option is implemented then remove the
|
|
||||||
# 'force-reload' alias
|
|
||||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||||
do_stop
|
do_stop
|
||||||
case "$?" in
|
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