Hello Unix and Linux Lovers!
I have spent now about 2 days looking for a solution of my problem but couldn't find a fitting one; I like to back up files to any usb stick which is connected on a raspberry pi running raspbian.
I write here things I know, so you see what is missing:
Using rsync will be the best for my purpose, this should work;
rsync -v /home/pi/data /mnt/usb
I can add the Job in crontab;
0 0 * * * rsync -v /home/pi/data /mnt/usb
This will back up my data every day (the 5 first signs are for the time Settings: Minutes Hours Days Months DayOfTheWeek, then Comes the command or script which should be executed).
I can manually Mount a USB Stick like this:
sudo mount -t vfat /dev/sda1 /mnt/usb
But what is missing:
How can I mount automatically every usb stick, which is plugged in, in the Directory /mnt/usb (or /mnt/usb1, /mnt/usb2 etc)?
How can I use rsync to sync the data in every Folder path? Do I Need a Shell script with a Loop or can I use it like this: rsync -v /home/pi/data /mnt/usb*?
Thanks in Advance for help, Kind Regards