Page 1 of 1

monit and copy logfile...

Posted: Tuesday 28 November 2017 12:43
by febalci
Hi All,

using domoticz as Synology package. I also have monit installed with the following config

Code: Select all

#check domoticz is running
check process domoticz with pidfile /usr/local/domoticz/var/domoticz.pid
    start program = "/var/packages/domoticz/scripts/start-stop-status start"
        stop program  = "/var/packages/domoticz/scripts/start-stop-status stop"
        if failed host localhost port 8084 then restart
        if 3 restarts within 5 cycles then timeout
        if memory > 110 MB then restart
#done
Whenever a manual or monit restart takes place, the domoticz log file is erased and start from scratch. What i need is to make:

Code: Select all

cp /usr/local/domoticz/var/domoticz.log /volume1/public/domoticz$Y$M$D$H$M.log
before the restart.

How can i copy the logfile just before domoticz start? Should i place the cp command in domoticz start-stop-status script, or is there a way to put it in monit config?

Thanks...