1

I heard that it is a good idea to schedule backup in crontab file.

I also head that it is bad to edit files while they are backed up.

It may happen that cron stats to backup a directory while I am still editing some files in the directory. What shall I do to prevent or deal with the above situation?

Can I be notified a few minutes before cron starts to run back up, so that I can stop editing? Can I be notified when backup scheduled by cron finishes, so that I can resume editing?

Tim
  • 101,790
  • What editors do you use? Unless you use one that truncates the original file when writing (such as ed or the original vi), or use dd to do the backup, there's little to worry about. – Mark Plotnick Apr 21 '15 at 01:56
  • emacs for text files, and Adobe Pro or PDFXChange for pdf files, .... Will they be problems? @MarkPlotnick. What do you mean by "truncates the original file"? Why is dd a problem? – Tim Apr 21 '15 at 02:39
  • What software are you using to do backups? – Mark Plotnick Apr 21 '15 at 02:58
  • rsync ..................... @Mark – Tim Apr 21 '15 at 03:02
  • 1
    The easiest way is to avoid the problem by scheduling backup at a time when you won't be working on the files. Alternatively consider a filesystem that supports snapshots such as btrfs or use LVM; but both of these will require restructuring your existing setup. – gogoud Apr 21 '15 at 05:39
  • @gogoud: Can I be notified when cron starts to back up, so that I can stop editing. – Tim Apr 21 '15 at 10:32
  • see post here on how to use notify-send from crontab to do a pop-up. Suggest you have a crontab line something like: export DISPLAY=:0 && notify-send "Backup warning" "Backup is about to begin, get ready..." -t 60000; sleep 2m; rsync.... Info about notify-send here - you might need to install notify-osd package first (if using debian-derived distro). – gogoud Apr 22 '15 at 06:27
  • Thanks. My script can backup, but the notifications aren't right. Could you help to take a look? @gogoud – Tim Apr 23 '15 at 02:28

0 Answers0