I am trying to write a script to backup my laptop to a NAS drive using rsync. I want the backup to be done, only if it has been more than a week since my last backup.
Each time the rsync command executes, I also create a file backuptime.txt file, with the time at which the script completed the job.
date > backuptime.txt
Now, I want to be able to read the backuptime.txt file (or get the modification time of the file), and compare it with the current time/date and see if its greater than 7 days. How do I acomplish this? The only reason why I am creating the file backuptime.txt is to compute elapsed time. If there is a particular format of the date command which would make this task easier, I would gladly use that.
Thanks in advance for your help.
-AJ