F
F
friktor2014-09-15 17:15:40
linux
friktor, 2014-09-15 17:15:40

How to make a backup on a server with linux?

It is necessary to make sure that the server makes a backup copy of the folder every week. The server is running Ubuntu 14.04. I know that you can use Cron for this - but I don’t know how to set up backup. Please tell me what needs to be done for this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
arthurchumak, 2014-09-15
@friktor

you need to create a bash script like this

#!/bin/bash
path='путь к папке'
archivepath='путь к архиву'
date=$(date +%y%m%d)
cd $path
tar -cf $archivepath/backup$date.tar *

and add to cron
@weekly путь к скрипту

M
Maxim, 2014-09-15
@Maxim_ka

Where do you want to backup your folder?
If you save on the local machine, but on a different partition/drive, then:
tar -cf /save_location/backup.tar /full_path/to_your_folder;
gzip -9 /save_location/backup.tar
add this to the script and set the cron to run once a week.
If you are going to backup to another machine over the network, then read about rsync there, the utility will be more fun

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question