Hi all,
I have an OpenSUSE terminal server and I would like to backup users home directories every day via Cron and Rsync. I am looking for a script or set of scripts that will enable me to do the following:
- Mount a NAS server at the start of the script. An example mount point would be:
/mnt/backup/home/
- Rsync to mirror users /home directories to the NAS based on some sort of username variable. If the user doesn't exist I would like it to be created on the NAS. For example there might be three users on the system: joebloggs, suzyshoe and ritasmith with their home directories at /home/joebloggs etc. Rsync would have to pull the username from the /home/<username> path and use it as a directory path on the NAS
- Depending on the day, it would need to go in to a subdirectory of the username based on the day.
on the NAS it would look like:
//NAS/backup/home/<username>/monday
//NAS/backup/home/<username>/tuesday
...
To save me having to go and create every single <day> folder I would prefer if this was automatically created the first time it is ran for that user.
- After the first lot of backups, subsequent backups on that day would have to overwrite the data that was there the week before.
- Unmount the NAS at the completion of the script.
I hope this makes sense. If I could put this all in one script using some sort of %day% like variable that would be preferable, but if I had to make one for each day that would be fine as long as cron had a way to differentiate between the scripts on different days.
I am fairly new to this so just let me know if you need more information or if I am not making any sense.
At the end of the day I would like to know that I can add a user to the system and automatically a directory for that user will be created on the NAS and their files backed up depending on the day.
Thanks!!