syn9673 Posted April 9, 2020 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 89 Reputation: 36 Joined: 04/22/19 Last Seen: March 27, 2024 Share Posted April 9, 2020 (edited) sqlbackup A super simple and lightweight SQL Database Backup System. This auto backsup your database every 24 Hours or more. Can't go less.Download (Code Here) Requirements - NodeJS v12+ - Understanding Installation - Download the Code. (can use git) - Go to the main directory of the code using your terminal/cmd. (Where index.js is) // run $ node . // or $ node index How to run this 24/7? This will close when you close your terminal. I good way to keep this up without closing is using `pm2`. To install `pm2`, simply do the following. $ npm install pm2 -g // or $ yarn add pm2 -g How would i run it? $ pm2 start index.js (Make sure you're in the main directory of the code. Where index.js is) That would make it run 24/7 even when closing the terminal/cmd. Config Defaults: { "mysql": { "username": "username", "password": "password", "host": "localhost", "port": 3306, "databases": [ "rathena4444_rag", "rathena4444_log" ] }, "backupInterval": 86400 } config.mysql is where all your mysql data would be. *.username is what your mysql username is. *.password is the password for your mysql username. *.host is where the mysql server is hosted. 127.0.0.1 or localhost for the same host or vps. *.databases[] an array of the name of the databases to backup. config.backupInterval is the amount of seconds to wait before creating a new backup. Default is 86400 (1 day). Take note that you can't go less than 86400. How does this work? I simply used child_process to create a new process and would run mysqldump to export Mysql databases. After exporting, the code closes the process of the ran command and then would wait for the interval to be finished, then repeat the process. Edited April 9, 2020 by UniC 2 1 Quote Link to comment Share on other sites More sharing options...
Secrets Posted April 15, 2020 Group: Developer Topic Count: 36 Topics Per Day: 0.01 Content Count: 588 Reputation: 437 Joined: 01/26/16 Last Seen: Wednesday at 03:00 PM Share Posted April 15, 2020 (edited) Why should one use this instead of cron (or Windows' Task Scheduler) for scheduling a backup? Edited April 15, 2020 by Secrets Quote Link to comment Share on other sites More sharing options...
syn9673 Posted April 15, 2020 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 89 Reputation: 36 Joined: 04/22/19 Last Seen: March 27, 2024 Author Share Posted April 15, 2020 The only advantage this has is the fact that it's simple to use, has an easy to setup config. But you need to install node.js And this would also work for linux. Quote Link to comment Share on other sites More sharing options...
Akkarin Posted April 15, 2020 Group: Forum Manager Topic Count: 282 Topics Per Day: 0.06 Content Count: 3144 Reputation: 1630 Joined: 03/26/12 Last Seen: Tuesday at 10:17 AM Share Posted April 15, 2020 7 hours ago, UniC said: the fact that it's simple to use But.. so is cron.. and you wouldn't need to install another package just to echo out the same code that you'd put into cron in the first place o.O 1 Quote Link to comment Share on other sites More sharing options...
ayami123 Posted September 15, 2024 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 2 Reputation: 0 Joined: 04/08/22 Last Seen: September 26, 2024 Share Posted September 15, 2024 On 4/16/2020 at 3:25 AM, Akkarin said: But.. so is cron.. and you wouldn't need to install another package just to echo out the same code that you'd put into cron in the first place o.O well there are other people maintaining pm2, which is good especially when there's a ui Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.