On May 19, 2025, Lee wrote:
On Sun, May 18, 2025 at 8:03 PM Greg Wooledge wrote:
On Sun, May 18, 2025 at 19:51:04 -0400, Lee wrote:
On Sun, May 18, 2025 at 4:51 PM Andy Smith wrote:
Hi,
On Sun, May 18, 2025 at 12:47:25PM -0400, Default User wrote:
Since I know almost no shell scripting, the rsync usb drive A
to usb drive B copy is done with a simple bash script consisting
only of the rsync backup command, with options and parameters, but without any code to verify that usb drive B is attached.
If your backup script is a bash script then all you need do is put something like:
if ! findmnt /mnt/usb-drive-b; then
just out of curiosity.. why "findmnt" instead of
if [ ! -d /mnt/usb-drive-b ]; then
It will always be a directory. The question is whether there's a file system mounted on it.
I have a script to do a quick rsync backup to usb and ran into the
same problem.. oops! I forgot to insert the usb stick.
After a bit of experimentation I found that checking for the existence
of the directory was good enuf:
-----------------
DEST="/media/lee/TravelDrive/deb-spot"
if [ ! -d "$DEST" ]; then
echo "$DEST does not exist!!" >&2
exit 1
fi
<.. snip ..>
-----------------
$ ./syncusb
/media/lee/TravelDrive/deb-spot does not exist!!
-----------------
Is "/media/USERID" magic or what?
In other words, why will /mnt/usb-drive-b always be a directory but /media/USERID doesn't exist unless the usb drive is mounted?
/media/$USER/filesystem-UUID (or Label, if available) is created and
removed dynamically by a udev rule for hotplug support.
Creating /mnt/mountdir manually means that it'll always be there,
whether or not the filesystem that's supposed to be mounted there is
actually mounted.
--
|_|O|_|
|_|_|O| Github:
https://github.com/dpurgert
|O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEE3asj+xn6fYUcweBnbWVw5UznKGAFAmgraRkACgkQbWVw5Uzn KGCCUA/+Prdem1ohbbeJYztis2pS+unlB1heC7Vokyr8Tdf+xP39BxmkRoAvj/7d Z8pz1Ma1Q/a4SuXF51hOn+GbgctrAIUEIILEQRImoqpvJ/6k+1+NsWI8NLeMWpA1 adPrhsORBHfXCfgRO3ja/Dr3Vq5/8hT8IpZd6XIl9WTXnceeZX/ZOwweJbMM7ZRo 6OMKo2GYEf6dzLQrUEw70ZCGn/FtzbwmMBcuJqV5cg6bKS1U63GQGK3keBI7963P LdiuTtwRobEA0waGeB6aw02fxBhTIASjioJ2ImWVMQUKnWe44gERT9LHZcyHlCFM UfysmVOPt0hfWfewQ/YMT1Zk9JqkQwLVsotuBD0BFrl6xSKJmLxnUQvIRIqr8AnE Kj0lgJPLT5aRqKqeTm7H9zvZN/yqcZAE68QTYmrE/ctP1/aqOqnaWJvWl4o1SM+p W1xJSgwYiuUjSd+VoUVc8hztX3Yo4M4uF4ZgtQanJo3I1KO7Sj43SI+jlKr50nmq vHhm7+Hb22rASI7DreTiuKTlyAKh10vy3gNlZUx0apaW7c68UJ0tZc2HJHgI2fHZ yWLaMfsZTmTc7/NT/3ZYHVTxvYnsJ48Pw+FqknHMIoWvHq7zKAYoKHNyOTlfcZRL 9xtFeSBjIie0vn9yudlFal4WvH3epha8POS/diMWd8ac/xsgAME=
=6dYJ
-----END PGP SIGNATURE-----
--- SoupGate-Win32 v1.05
* Origin: fsxNet Us