I'm working with a small Arm board (Emtrion) running Debian Linux. Emtrion has provided an sdcard image that can update the boards flash. I would like to extend the simple update script, so that when it is finished, it waits for the user to eject the sdcard, and when that happens reboot. So I'm looking for some simple script mechanism to basically wait for that event. I tried something like:
tail -f -n 1 /var/log/messages | grep -m 1 "card removed"
reboot
My thinking was that I would just troll messages, and that the -m 1 flag would cause grep to exit when it found its first match. Alas, that doesn't seem to work, it just keeps going. So I'm hoping there's some other trick/technique I can use. I'm really after something I can do inside of the existing script. I don't have expect in this image, so that's not an option. It appears to be running busybox.