0 votes
in Servers by (2.1k points)
edited by
I have a file called 1backupfiles in a directory on my server.  I call this file through a terminal after moving into the director using the command line entry cp.  Once in the directory I use this command to copy all the files en mass (into one big file) and individual website directories ...

sudo bash 1backupfiles

The content of the file is below ...

#!/bin/bash

# Backup Files script

date=$(date +"%m_%d_%Y_%h_%i_%s")

# The below line backs up the entire file system and adds the date to the file name.  To overwrite the created files you simply remove $date from the below lines

sudo tar -zcvpf allfiles$date.tgz /var/location of my html or htdocs directory

# moves the created file

sudo mv allfiles$date.tgz /var/location of my backup directory/

# backs up individual website directory

sudo tar -zcvpf directory$date.tgz /var/location of directory

# moves the created file to backup directory

sudo mv name of directory$date.tgz /var/location of my backup directory/

The above backs up the whole file system of my server and also a website directory.  I have at least 10 website directories being backed up and moved in this manner.  The data affix means previous backups are stored for safe keeping though will need to be deleted at times should space be a problem.

Please log in or register to reply to this topic.

...