File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,17 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
15
15
DESC=" Domoticz Home Automation System"
16
16
NAME=domoticz
17
17
USERNAME=pi
18
- DAEMON=/home/$USERNAME /domoticz/$NAME
19
- # DAEMON_ARGS="-daemon -www 8080 -sslwww 443 -log /tmp/domoticz.txt"
20
- # DAEMON_ARGS="-daemon -www 8080 -sslwww 443 -syslog"
21
- DAEMON_ARGS=" -daemon -www 8080 -sslwww 443"
22
18
PIDFILE=/var/run/$NAME .pid
23
19
SCRIPTNAME=/etc/init.d/$NAME
24
20
21
+ DAEMON=/home/$USERNAME /domoticz/$NAME
22
+ DAEMON_ARGS=" -daemon"
23
+ # DAEMON_ARGS="$DAEMON_ARGS -daemonname $NAME -pidfile $PIDFILE"
24
+ DAEMON_ARGS=" $DAEMON_ARGS -www 8080"
25
+ DAEMON_ARGS=" $DAEMON_ARGS -sslwww 443"
26
+ # DAEMON_ARGS="$DAEMON_ARGS -log /tmp/domoticz.txt"
27
+ # DAEMON_ARGS="$DAEMON_ARGS -syslog"
28
+
25
29
# Exit if the package is not installed
26
30
[ -x " $DAEMON " ] || exit 0
27
31
Original file line number Diff line number Diff line change @@ -712,18 +712,30 @@ int main(int argc, char**argv)
712
712
g_bRunAsDaemon = true ;
713
713
}
714
714
715
+ std::string daemonname = DAEMON_NAME;
716
+ if (cmdLine.HasSwitch (" -daemonname" ))
717
+ {
718
+ daemonname = cmdLine.GetSafeArgument (" -daemonname" , 0 , DAEMON_NAME);
719
+ }
720
+
721
+ std::string pidfile = PID_FILE;
722
+ if (cmdLine.HasSwitch (" -pidfile" ))
723
+ {
724
+ pidfile = cmdLine.GetSafeArgument (" -pidfile" , 0 , PID_FILE);
725
+ }
726
+
715
727
if ((g_bRunAsDaemon)||(g_bUseSyslog))
716
728
{
717
729
setlogmask (LOG_UPTO (LOG_INFO));
718
- openlog (DAEMON_NAME , LOG_CONS | LOG_PERROR, LOG_USER);
730
+ openlog (daemonname. c_str () , LOG_CONS | LOG_PERROR, LOG_USER);
719
731
720
732
syslog (LOG_INFO, " Domoticz is starting up...." );
721
733
}
722
734
723
735
if (g_bRunAsDaemon)
724
736
{
725
737
/* Deamonize */
726
- daemonize (szStartupFolder.c_str (), PID_FILE );
738
+ daemonize (szStartupFolder.c_str (), pidfile. c_str () );
727
739
}
728
740
if ((g_bRunAsDaemon) || (g_bUseSyslog))
729
741
{
@@ -788,7 +800,7 @@ int main(int argc, char**argv)
788
800
daemonShutdown ();
789
801
790
802
// Delete PID file
791
- remove (PID_FILE );
803
+ remove (pidfile. c_str () );
792
804
}
793
805
#else
794
806
// Release WinSock
You can’t perform that action at this time.
0 commit comments