embedded linux - How to provide a restart count to systemd service -


i have embedded device manages various services using systemd. our status reporting application 1 of these services. on , automatically restarts on failure (crashes, exceptions, oom conditions, whatever).

we report event our cloud services on device restart (technically application restart) i'd distinguish first start (after reboot) restart. there mechanism built systemd can provide service restart count, or need roll own method?

do have journal ? if do, can count this:

journalctl -b -u myservicename.service |grep -c started 

the -b option limits logs current boot; -u limits service in argument.

then grep "started" line, , tell grep give number of matches.


Comments

Popular posts from this blog

php - Embed BBCode within itself not working -

Connecting Spring Batch to Remote Cassandra Database -

minify - Minimizing css files -