mirror of
https://github.com/Llewellynvdm/Backup-System.git
synced 2024-09-24 16:59:01 +00:00
added the date switch and updated the readme with clone details
This commit is contained in:
parent
e5625ce63b
commit
80b174a05b
@ -13,6 +13,12 @@ The Bash scripts used to backup database and folders on a server
|
|||||||
|
|
||||||
## Getting started
|
## 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.
|
Rename __config.txt__ to __config.sh__ and update the values in the file.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -12,3 +12,6 @@ REMOTESSH="user@yourserver.com"
|
|||||||
REMOTEDBPATH="your_db_path/"
|
REMOTEDBPATH="your_db_path/"
|
||||||
REMOTEWEBPATH="your_website_pat/"
|
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
16
incl.sh
@ -31,8 +31,22 @@ function zipDB {
|
|||||||
cd "$tmpFolder"
|
cd "$tmpFolder"
|
||||||
# db server ip address
|
# db server ip address
|
||||||
DBSERVER="$1"
|
DBSERVER="$1"
|
||||||
|
# check if date use is set
|
||||||
|
if [ -z ${USEDATE+x} ]; then
|
||||||
|
USEDATE=0
|
||||||
|
fi
|
||||||
# set the file name
|
# 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 to backup
|
||||||
DATABASE="$3"
|
DATABASE="$3"
|
||||||
# user that has access to do this
|
# user that has access to do this
|
||||||
|
Loading…
Reference in New Issue
Block a user