Answer the question
In order to leave comments, you need to log in
How to make the script take the last minute of the record from the file?
Please tell me how to set a parameter in the script so that it takes the last minute, for example
#!/bin/bash
for ii in $(journalctl -p err > erors.txt)
do
sleep
done
-- Logs begin at Mon 2018-03-05 13:09:15 EST, end at Mon 2018-03-05 14:30:34 EST
Mar 05 13:09:34 localhost.localdomain systemd[1]: Failed to start logs in /restar
Mar 05 13:18:07 localhost.localdomain systemd[1]: Failed to start logs in /restar
Mar 05 13:20:28 localhost.localdomain kernel: e1000 0000:00:03.0 enp0s3: Reset a
Mar 05 13:26:17 localhost.localdomain systemd[1 ]: Failed to start logs in /restar
Mar 05 14:08:05 localhost.localdomain systemd[1]: Failed to start logs in /restar
for example, the script was launched at 14:09:00, it should output only the last record to the file =) #(I don’t know how to describe it in another way)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question