stjude1982
New Member
Hi,
I'm new to Linux and I'm not sure where to place this thread?
I'm looking to start using raspberry pi for some projects around house.
Want to be able to back up files automatically to usb using cron, but, first have to create bash script in order to do so.
The folder I would like to back up is named ' family ' and I've managed to create an automatic mount point for usb as ' /media/usb ' (this seems to work if usb is mounted at boot but not if it's plugged in after boot).
First thing I want to be able to do is verify the existence of the usb before back-up. Was going to use rysnc for back as this sounds like the best command based on the command only saving changes. I've a couple of questions:
1-is rsync the best command to use? I've read that the command uses timestamp to check for differences and don't know how this will be affected with files saved to usb.
2-is the following if statement going to check for the existence of a usb?
3-what do I do with the else part of the statement if a usb is not present?
if [-e /media/usb] ; then
rsync -a ~/family /media/usb
else ???????????
fi
Any help would be greatly appreciated.
Thank you!
I'm new to Linux and I'm not sure where to place this thread?
I'm looking to start using raspberry pi for some projects around house.
Want to be able to back up files automatically to usb using cron, but, first have to create bash script in order to do so.
The folder I would like to back up is named ' family ' and I've managed to create an automatic mount point for usb as ' /media/usb ' (this seems to work if usb is mounted at boot but not if it's plugged in after boot).
First thing I want to be able to do is verify the existence of the usb before back-up. Was going to use rysnc for back as this sounds like the best command based on the command only saving changes. I've a couple of questions:
1-is rsync the best command to use? I've read that the command uses timestamp to check for differences and don't know how this will be affected with files saved to usb.
2-is the following if statement going to check for the existence of a usb?
3-what do I do with the else part of the statement if a usb is not present?
if [-e /media/usb] ; then
rsync -a ~/family /media/usb
else ???????????
fi
Any help would be greatly appreciated.
Thank you!