Difference between revisions of "Automating your backups with cron"

From docwiki
Jump to: navigation, search
Line 18: Line 18:
 
</pre>
 
</pre>
   
which opens up your default editor.
+
which opens up your default editor. You can set a different editor with
  +
  +
  +
<pre>
  +
export EDITOR=/usr/bin/yourfavoriteeditor
  +
</pre>
  +
   
   

Revision as of 12:36, 29 October 2020

Motivation

If you only do your backup when you hear about a case of someone loosing data then you will not have a recent backup when you need it. So you should automate the backup process. If you want to run a certain command at a regular interval then you can use the unix cron tool.

User and System Crontab

cron has a text based configuration file that contains the commands that should be run and when they should be run. You can view this with

crontab -l

And edit it with:

crontab -e

which opens up your default editor. You can set a different editor with


export EDITOR=/usr/bin/yourfavoriteeditor


Example Crontab