Backup script using Bash and Make to backup certain directory.
Ubuntu comes with make pre-installed, but if this was not the case install it using:
$ sudo apt install make
1 - Clone the repo.
2 - you can use the script in two ways: (using make directly or runnning the bash script).
a - $ make ARG1="[absolute path to dir you want to backup]" ARG2="backupdir/" ARG3="[Interval-sec]" ARG4="[Max-backups]"
b - First run $ chmod +x backupd.sh
then run $ ./backupd.sh [absolute path to dir you want to backup] backupdir/ [interval-sec] [max-backups]
3 - Try to make a change in the specified directory and open backupdir to see the backup directory with modification date.
4 - You can open 'changes_made.txt' file to see change history.
- Get the initial directory info and save to file directory-info.last
- Copy your source to destination
- Loop forever
- Sleep interval of time
- Get the directory info and save to new file directory-info.new
- If ( directory data was changed)
- Copy the directory to new backup location backupdir/
- Update the directory-info.last