1
0
mirror of https://github.com/Llewellynvdm/Backup-System.git synced 2024-12-12 08:57:47 +00:00

added the date switch and updated the readme with clone details

This commit is contained in:
Llewellyn van der Merwe 2017-06-05 17:54:16 +01:00
parent e5625ce63b
commit 80b174a05b
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
3 changed files with 25 additions and 2 deletions

View File

@ -13,13 +13,19 @@ The Bash scripts used to backup database and folders on a server
## Getting started
Clone Repository
```bash
$ git clone ssh://git@projects.vdm.io/system-backup.git system-backup
```
Rename __config.txt__ to __config.sh__ and update the values in the file.
```bash
$ mv config.txt config.sh
```
Rename __folders.txt__ to __folders__ and update the values in the file.
Rename __folders.txt__ to __folders__ and update the values in the file.
```bash
$ mv folders.txt folders

View File

@ -12,3 +12,6 @@ REMOTESSH="user@yourserver.com"
REMOTEDBPATH="your_db_path/"
REMOTEWEBPATH="your_website_pat/"
## 0 = no date | 1 = year | 2 = year-month | 3 = your-month-day | 4 = your-month-day:time # For DB file name
USEDATE=0

16
incl.sh
View File

@ -31,8 +31,22 @@ function zipDB {
cd "$tmpFolder"
# db server ip address
DBSERVER="$1"
# check if date use is set
if [ -z ${USEDATE+x} ]; then
USEDATE=0
fi
# set the file name
FILE=`date +"%Y%m"`"_$2.sql"
if [ "$USEDATE" -eq "4" ]; then
FILE=`date +"%Y-%m-%d:%H:%M:%S"`"_$2.sql"
elif [ "$USEDATE" -eq "3" ]; then
FILE=`date +"%Y-%m-%d"`"_$2.sql"
elif [ "$USEDATE" -eq "2" ]; then
FILE=`date +"%Y-%m"`"_$2.sql"
elif [ "$USEDATE" -eq "1" ]; then
FILE=`date +"%Y"`"_$2.sql"
else
FILE="$2.sql"
fi
#database to backup
DATABASE="$3"
# user that has access to do this