nicer version of the worker-skript attached

wait 5 seconds and try again before send "killall"
prevents system-mails at reboot noticed on my testserver-VM
maybe also nicer in cases of shot overload with coming back

it should not take in action normally for weeks and if it
does 5 seconds more or less are not important, it's always
fast than someone ringing you out of the bed :-)

Am 19.08.2013 16:28, schrieb Reindl Harald:
> way too much overhead in case of systemd-services
> http://www.freedesktop.org/software/systemd/man/systemd.service.html
> 
> the only case which is needs to be supported by the service
> itself is "WatchdogSec=" for exactly this case which i
> solved with the attached solution
> 
> any other sort of crash and termination is controlled
> out-of-the-box by systemd itself with proper units
> 
> Am 19.08.2013 16:25, schrieb Harald Leithner:
>> Nice, but you should really try monit. And M/Monit.
>>
>> Am 19.08.2013, 16:18 Uhr, schrieb Reindl Harald <[email protected]>:
>>
>>> i recently wrote a PHP Skript which is running in
>>> an endless-loop and try to connect every 10 seconds
>>> to 127.0.0.1 and receive the service-greeting
>>>
>>> if the connection fails or there is no response
>>> "killall dbmail-imapd" or "killall dbmail-pop3d"
>>>
>>> on systemd-systems with "Restart=always" the "killall"
>>> triggers the restart by systemd while prevent that
>>> a for whatever reason manually stopped daemon get
>>> fired up by a restart and this should catch the cases
>>> from thursday where the processes refused to respond
>>>
>>> another script greps the syslog for "time over, scheduling restart"
>>> twice an hour and triggers cronmails to take notice of this but
>>> that does a lot of other things on the infrastructure and so no
>>> way to publish ist
>>>
>>> anybody feel free to reuse these two units and the worker
>>> on systemd-installations (yes, i know PHP is not the first
>>> language for services, but the one i use regulary *gg*)
>>> ________________________________________________________
>>>
>>> [root@mail:~]$ systemctl status monitor-dbmail-imapd.service
>>> monitor-dbmail-imapd.service - monitor dbmail-imapd
>>>    Loaded: loaded (/etc/systemd/system/monitor-dbmail-imapd.service; 
>>> enabled)
>>>    Active: active (running) since Mo 2013-08-19 16:07:16 CEST; 5min ago
>>>  Main PID: 5209 (check-dbmail-se)
>>>    CGroup: name=systemd:/system/monitor-dbmail-imapd.service
>>>            └─5209 /usr/bin/php /usr/local/bin/check-dbmail-service.php 143 
>>> dbmail-imapd
>>>
>>> [root@mail:~]$ systemctl status monitor-dbmail-pop3d.service
>>> monitor-dbmail-pop3d.service - monitor dbmail-pop3d
>>>    Loaded: loaded (/etc/systemd/system/monitor-dbmail-pop3d.service; 
>>> enabled)
>>>    Active: active (running) since Mo 2013-08-19 16:07:16 CEST; 5min ago
>>>  Main PID: 5210 (check-dbmail-se)
>>>    CGroup: name=systemd:/system/monitor-dbmail-pop3d.service
>>>            └─5210 /usr/bin/php /usr/local/bin/check-dbmail-service.php 110 
>>> dbmail-pop3d

<<attachment: check-dbmail-service.php>>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to