Page 1 of 1

undocumented -pidfile allows pid file location yay! :)

Posted: Tuesday 10 November 2015 23:14
by DaaNMaGeDDoN
Hi, not sure if this is something new to others, but i just found that the domoticz binary/daemon accepts a -pifile parameter to specify the pifile location! :)
I think this means i can finally manage domoticz through a proper Debian LSB init script without having to use root....right?
Anyway this speaks for itself i think:

Code: Select all

root@serverddlin2:/home/domoticz# strings /home/domoticz/domoticz_beta/domoticz | grep pid
getpid
getppid
pidFilehandle
/var/run/domoticz.pid
-pidfile
getppid@@GLIBC_2.2.5
getpid@@GLIBC_2.2.5
pidFilehandle
root@serverddlin2:/home/domoticz# ls -ld /var/run/domoticz
drwxr-xr-x 2 domoticz domoticz 40 Nov 10 22:32 /var/run/domoticz
root@serverddlin2:/home/domoticz# rm /var/run/domoticz.pid
root@serverddlin2:/home/domoticz# ps aux | grep domo
root     30674  0.0  0.0  12720  2104 pts/0    S+   22:41   0:00 grep domo
root@serverddlin2:/home/domoticz# su - domoticz -c "/home/domoticz/domoticz_beta/domoticz -www 9090 -log /var/log/domoticz/domoticz.log -pid /var/run/domoticz/domoticz.pid -daemon"
2015-11-10 22:42:22.270  Domoticz V2.3568 (c)2012-2015 GizMoCuz
2015-11-10 22:42:22.271  Build Hash: 2436ee2, Date: 2015-11-10 09:27:15
2015-11-10 22:42:22.271  Startup Path: /home/domoticz/domoticz_beta/
domoticz: Domoticz is starting up....
domoticz: Could not open PID lock file /var/run/domoticz.pid, exiting
root@serverddlin2:/home/domoticz# su - domoticz -c "/home/domoticz/domoticz_beta/domoticz -www 9090 -log /var/log/domoticz/domoticz.log -pidfile /var/run/domoticz/domoticz.pid -daemon"
2015-11-10 22:42:34.577  Domoticz V2.3568 (c)2012-2015 GizMoCuz
2015-11-10 22:42:34.577  Build Hash: 2436ee2, Date: 2015-11-10 09:27:15
2015-11-10 22:42:34.577  Startup Path: /home/domoticz/domoticz_beta/
domoticz: Domoticz is starting up....
root@serverddlin2:/home/domoticz# cat /var/run/domoticz/domoticz.pid
30717
root@serverddlin2:/home/domoticz# ps aux | grep domoticz
domoticz 30717  0.4  0.1 771112 12436 ?        Ssl  22:42   0:00 /home/domoticz/domoticz_beta/domoticz -www 9090 -log /var/log/domoticz/domoticz.log -pidfile /var/run/domoticz/domoticz.pid -daemon
root     31008  0.0  0.0  12720  2280 pts/0    S+   22:42   0:00 grep domoticz
root@serverddlin2:/home/domoticz# /home/domoticz/domoticz_beta/domoticz --help
2015-11-10 22:44:35.709  Domoticz V2.3568 (c)2012-2015 GizMoCuz
2015-11-10 22:44:35.709  Build Hash: 2436ee2, Date: 2015-11-10 09:27:15
2015-11-10 22:44:35.709  Startup Path: /home/domoticz/domoticz_beta/
2015-11-10 22:44:35.709  Usage: Domoticz -www port -verbose x
        -www port (for example -www 8080)
        -wwwbind address (for example -wwwbind 0.0.0.0 or -wwwbind 192.168.0.20)
        -sslwww port (for example -sslwww 443)
        -sslcert file_path (for example /opt/domoticz/server_cert.pem)
        -sslpass passphrase for private key in certificate
        -wwwroot file_path (for example /opt/domoticz/www)
        -dbase file_path (for example /opt/domoticz/domoticz.db)
        -userdata file_path (for example /opt/domoticz)
        -verbose x (where x=0 is none, x=1 is debug)
        -startupdelay seconds (default=0)
        -nowwwpwd (in case you forgot the web server username/password)
        -nocache (do not return appcache, use only when developing the web pages)
        -log file_path (for example /var/log/domoticz.log)
        -loglevel (0=All, 1=Status+Error, 2=Error)
        -notimestamps (do not prepend timestamps to logs; useful with syslog, etc.)
        -daemon (run as background daemon)
        -syslog (use syslog as log output)
As you can see im running the beta from this morning, let me know if i lived under a rock or (hopefully) i have been clever ;)

Re: undocumented -pidfile allows pid file location yay! :)

Posted: Wednesday 11 November 2015 8:15
by gizmocuz
Correct, it was not added to the "help" output yet.
You can also run domoticz multiple times now, as long as you specify another pid file