Mainos / Advertisement:
Ero sivun ”Backup/en” versioiden välillä
Siirry navigaatioon
Siirry hakuun
(Ak: Uusi sivu: 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")) |
(Ak: Uusi sivu: Test the backup by running the bash script:) |
||
Rivi 24: | Rivi 24: | ||
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") | 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 | sh /root/backup.sh |
Versio 10. helmikuuta 2015 kello 06.36
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
Ajastettu backup
Backupin voi ajastaa crontabin avulla. Avaa crontab:
nano /etc/crontab
ja lisää seuraava rivi
0 0 * * * root /root/backup.sh
Nyt ajetaan backup joka päivä kello 24.
Vinkkejä
Näin saat lisätietoja:
man date man time
Mainos / Advertisement: