Hello in the sudo systemctl status <service>
I sometimes see an error in text like [info] asio async_shutdown error: asio.system:32 (Broken pipe)
, yet it is still marked as [info] and status of service is active (running)
.
I need to monitor the service log and if there is a word error
in the log I need to issue sudo systemctl restart <service>
. Is that possible?
tail -f some-logfile | awk '/some-pattern/ {system("run-some-command")}'
. it will require some scripting, but is entirely possible.sudo journalctl -f -u ifi-streamer-tidal-connect.service | awk '/Max connection attempts/ {system("systemctl restart ifi-streamer-tidal-connect.service")}'
Feb 03 15:04:54 tidal-pi tidal_connect_application[21553]: [2022-02-03 15:04:54.239] [tisoc] [warning] [logger.cpp:22] [audio_worker.cpp:288] Max connection attempts reached!
--no-pager
option to your journalctl command.