Mainos / Advertisement:

Backup

Kohteesta Taisto
Versio hetkellä 10. helmikuuta 2015 kello 06.37 – tehnyt Frans (keskustelu | muokkaukset) (Ak: Uusi sivu: Find more information with:)
(ero) ← Vanhempi versio | Nykyinen versio (ero) | Uudempi versio → (ero)
Siirry navigaatioon Siirry hakuun
Muut kielet:
English • ‎suomi

Here is an example of simple backups for Linux.

Create directories

 mkdir /backup
 mkdir /backup/data

Create a bash script file /root/backup.sh

nano /root/backup.sh

Example file:

tar -cvf /backup/intra/$(date +%y%m%d).tar /data/intra

%y = year

%m = month

%d = day

Backup is automatically saved by date under the /backup/intra directory. A compressed .tar file is named automatically by the date of saving. ("02122014.tar")

Test the backup by running the bash script:

 sh /root/backup.sh

Timed Backup

Backup can be timed using Crontab. Open crontab:

 nano /etc/crontab

and add the following line

 0 0    * * *   root    /root/backup.sh

This will create the backup every day at 2400 hours.

Tips

Find more information with:

man date
man time
Mainos / Advertisement: