1

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.

  • Does your embedded system include udev? If yes then you can probably hook in to that to be notified when a device is removed, without any log file trolling hacks. – Celada Jul 28 '15 at 22:31
  • I think it is not using udev. None of the conf files for it seem to exist. I do have an \sbin\mdev which is a symlink to busybox – Travis Griggs Jul 28 '15 at 23:04
  • 1
    busybox doesn't have udev, it has mdev instead. i think this answer might have what you want. – gwillie Jul 28 '15 at 23:58

0 Answers0