I need to backup few files on my Mac, and it can be done inside of Emacs by calling a function. But it is a tedious task to do everyday and sometimes I forgot doing it.

I wonder if I can automate it by using the run-at-time function and make it backup at the mid night, and wonder what if

  • the computer is locked?
  • the laptop lip is closed?
  • the computer is inactive for a long time and in sleep mode?
  • 2
    That doesn't really sound Emacs-related. – wasamasa May 18 '15 at 12:07
  • 2
    This would be best done outside of emacs. – Jordon Biondo May 18 '15 at 13:57
  • Here is a link that explains how to use rsync with Emacs: emacs.stackexchange.com/a/5844/2287 If the original poster wishes to remove the bullet points to make the question Emacs specific, then the question would likely pass muster -- although backups using Emacs should probably be done manually as jch states in the answer below. The linked thread also contains other methods for backing up -- e.g., Dropbox, etc. – lawlist May 18 '15 at 19:44

My personal opinion is that Emacs is not an operating system, and while it is often convenient to do things in Emacs, this is the kind of task that is better solved outside of Emacs.

Scheduling your backups within Emacs means that they won't run if Emacs is not running, and that they might run twice if you have two instances of Emacs open. Since Emacs has very primitive facilities for asynchronous tasks, your Emacs might stutter or even hang while the backup is being done.

There are a number of OS-level tools for scheduling tasks (cron, anacron, launchd), but they are best discussed elsewhere or somewhere else.

| improve this answer | |
  • Why Superuser over Unix.SE? – PythonNut May 18 '15 at 16:26
  • @PythonNut edited. – jch May 18 '15 at 16:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.