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

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -