Suspend s6-log writing to log file and resume it back after sometime

2021-06-08 Thread Thiyagarajan, Deva
Hello,



I am running s6 on an embedded platform and use s6-log for logging processes’ 
output to hard disk.


I have a requirement where I need to pause logging to hard disk when the device 
is put to standby/sleep mode (basically to reduce hard disk usage and spin it 
down) and once the device is back UP from sleep, I want the logging to resume 
since the point it paused.

Basically during the sleep, s6-log should just hold the logs in memory and when 
device is UP it should start dumping the logs as usual.



Any pointers on how I can go about this? Is there any hack or tricks that could 
be done in s6-log to achieve this?



Thanks in advance


--

Deva


Re: Suspend s6-log writing to log file and resume it back after sometime

2021-06-08 Thread Laurent Bercot

Any pointers on how I can go about this? Is there any hack or tricks that could 
be done in s6-log to achieve this?


 Sorry, but no, nothing comes to mind - s6-log was not designed for 
this.


 I don't think expecting services to keep running while not logging to
disk, whether or not in standby/sleep mode, is reasonable: if logs keep
coming up, memory fills up. What do you do if the machine doesn't wake
up before the memory is full? The logger will die and you will lose all
your carefully accumulated logs.

 Ideally, you would have dynamic verbosity in the service, and switch
it to zero when going into standby/sleep mode, so it would stop
producing logs, so you'd never wake up the disk. Of course, unless it's
the wakeup event listener, the concept of still having a service running
when in standby mode is weird: it defeats the very purpose of standby
mode, which is saving energy. The best way to not have your disk spin is
to have nothing to make it spin in the first place. :P

 s6-svc -p all your services when entering standby mode! (Except the
wakeup event listener.) :D

 Sorry for being unhelpful, and good luck,

--
 Laurent