Linux Backup
Version 2.1.0
Install
To install this package you need git and composer
git clone https://github.com/Edrard/Linux-Backup.git
composer install
Use
All ftp php function and exec() function must be removed from "disabled function". exec() used to run linux zip app(having problems with ZipArchive class, becouse of temporary files). After installation, configuration it. Main config file is — ftp.json
Config generator
To create configuration use Web generator - gen.html
Manual Config
Example Config
{
"backup": {
"1": {
"src": "\/usr\/local\/backup",
"dstfolder": "\/site\/base",
"local": "base\/",
"type": "now",
"days": "0",
"mounths": "0",
"filename": "base",
"file inc": "d-m-Y",
"type backup": "file",
"exclude": "",
"mysqlbase": "",
"mysqlconfig": "",
"dst": "1"
},
"2": {
"src": "",
"dstfolder": "\/site\/vamark",
"local": "base\/mysql\/",
"type": "time",
"days": "5",
"months": "0",
"filename": "mysql",
"file inc": "d-m-Y",
"type backup": "mysql",
"exclude": "",
"mysqlbase": "mysql",
"mysqlconfig": "1",
"dst": "1"
}
},
"con fig": {
"1": {
"host": "mx.com",
"user": "test",
"pass": "1234",
"type": "ftp"
}
},
"mysql": {
"1": {
"host": "local host",
"user": "root",
"pass": "123456"
}
},
"log": {
"file": {
"dst":"nlog",
"full":"1"
},
"mail": {
"user": "",
"pass": "",
"smtp": "",
"port": "25",
"from": "",
"to": "",
"separate":"1",
"host name":"My Server"
}
}
}
src — source where take files, can be multiple separated by comma
dstfolder — where to store on FTP
local — local folder to keep files, not needed for NowFile type. Can be used in any way absolute or relative path. Must be separated for actions.
type — can be "now", "time", "increment" (if type backup — mysql, then always time)
now — just sync folder changes
time — keep last N days full archives
increment — keep monthly full + increment for every day.
days — ammount of days to keep backup files(only for time backup)
months — needed only for increment, how many full month archives to keep
filename — archive filename
file inc — additional name generated by php function date()
type backup — can file or MySQL
exclude — disabled right now
mysqlbase — if + then backup all bases or place name of the bases separated by space
mysqlconfig — config number for MySQL backup
dst — destination configuration. If no destination configuration seated, then no external syncing
Config Right now possible only FTP
MySQL just normal MySQL credentials
Log
Log configuration section. In file, we have two parameters.
dst — destination folder for logs full — if 1, then we log everything, if any another or empty value, then only error, warning,critical.
If you wish to receive mail notification with logs, then go to mail section.
user — login for email
pass — password from email
smtp — SMTP server
port — SMTP port server
from — email from who we send
to — recipient email, separated by comma
separate — if 1, then separate mails by type and send multiple emails, if any another or empty value then one merged mail will send
host name — used for subject
After all add next cron job from file backup_cron to you /etc/cron.d/