Article 581KJ [SOLVED] Wait for text in log file (awk anyone?)

[SOLVED] Wait for text in log file (awk anyone?)

by
gregors
from LinuxQuestions.org on (#581KJ)
Hi there!

I want to write me a backup script. The overall procedure I have in mind is:

- log in as root
- start script
- start backup disk (external 4 TB USB drive)
- wait until backup finishes

So what I see in /var/log/messages when the backup disk is plugged in is something like this:

Code:Sep 11 01:47:06 mimi kernel: [50974.093519] sd 7:0:0:0: [sdh] Spinning up disk...
Sep 11 01:47:06 mimi mtp-probe: checking bus 3, device 3: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-6/3-6.1"
Sep 11 01:47:06 mimi mtp-probe: bus: 3, device: 3 was not an MTP device
Sep 11 01:47:06 mimi mtp-probe: checking bus 3, device 3: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-6/3-6.1"
Sep 11 01:47:06 mimi mtp-probe: bus: 3, device: 3 was not an MTP device
Sep 11 01:47:16 mimi kernel: [50975.123016] .........readyHow can I make my script wait until the two bold texts appeared? I remember that I did something like this with awk, but that's long ago (~20 years) and I don't have a backup of that script.

So is there anyone who can help me with this?

Ideally the result would run on any Unix and would use old, reliable and widely available tools.

TIA

Gregorlatest?d=yIl2AUoC8zA latest?i=j-1K28uB3ms:TdxOiaQLZRQ:F7zBnMy latest?i=j-1K28uB3ms:TdxOiaQLZRQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=j-1K28uB3ms:TdxOiaQLZRQ:gIN9vFwj-1K28uB3ms
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments