Re: How to get service reload timestamp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Mon, 8 Jan 2024 at 11:49, port19 <port19@xxxxxxxxxx> wrote:
Hi all,

we currently have a monitoring check that alerts us of a service-specific config file having changed more recently than the services last restart.
We retrieve the restart time via `systemctl show <service> --property=ActiveEnterTimestamp`.
Is there a comparably elegant way to retreive the reload timestamp?
To avoid confusion, by reload I do not mean `systemctl daemon-reload`, I mean `systemctl reload <service>`.

Alternatively, is there a way to let systemd handle the reloading of services on change of related config files?
You didn't say what systemd version you use (mine is 255) 
systemctl show httpd | fgrep -i rel
ReloadResult=success
ReloadSignal=1
ExecReload={ path=/usr/bin/httpd ; argv[]=/usr/bin/httpd -k graceful ; ignore_errors=no ; start_time=[Mon 2024-01-08 17:08:45 GMT] ; stop_time=[Mon 2024-01-08 17:08:45 GMT] ; pid=1476187 ; code=exited ; status=0 }
ExecReloadEx={ path=/usr/bin/httpd ; argv[]=/usr/bin/httpd -k graceful ; flags= ; start_time=[Mon 2024-01-08 17:08:45 GMT] ; stop_time=[Mon 2024-01-08 17:08:45 GMT] ; pid=1476187 ; code=exited ; status=0 }
ManagedOOMMemoryPressureLimit=0
CanReload=yes

So with a bit of awk you can get at it this way
failing that, every reload is actually done via an ExecReload command in the service file, so you could intercept this with your own command instead

NeedDaemonReload=no
 

Best,
port19

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux