database-and-server-backup
Backup database and server.
Usage
Make sure:
- You have SSH login without password.
- You have
mysql-client
installed andmysqldump
command is running on terminal. (In Linuxsudo apt-get install mysql-client
)
Install library to your project with yarn or npm.
yarn add database-and-server-backupnpm i database-and-server-backup
Import library to your JS file.
const backup =
Create a config object.
const config = mysql: '-u' 'yourUsername' '--password=yourPassword' '-h' 'yourIp' 'yourDatabaseName' server: 'yourUsername@yourIp:/your/folder' backupFolder: '/home/user/full/path'
Pass config object to the backup function.
Run the script.
node file.js