Back up to disk automatically when disk is inserted

Polytropon freebsd at edvax.de
Thu Jan 30 13:20:59 UTC 2020


On Thu, 30 Jan 2020 09:10:35 +0100, Andrea Venturoli wrote:
> Failing this, is there some way for my script to check whether the boot 
> process has already ended?

You could do the following: Check /var/log/messages and look
for the _timestamps_ of

	1. system boot messages (pick a unique one)

	2. disk insertion messages (pick suiting one)

If the timestamps are within a certain range, the disk must
have been inserted already, so the backup script would exit.
If not, i. e., message timestamps differ "too much", the disk
has been inserted "just now" (you can compare this with the
_current_ system time), and the backup process can begin.

I know, very unelegant, but will probably work. This is the
case of makeshift workarounds that lasts forever... ;-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list