Back up webserver to NAS

Status
Not open for further replies.

oguruma

Patron
Joined
Jan 2, 2016
Messages
226
I have a LAMP server that I want to back up to my FreeNAS box. I want to do a daily/weekly/monthly backup of the site files as well as the databases.

I want to make a script to do this with RSYNC.

I know how to make keys and the backup script from the server side, but for security's sake I would rather pull the files from my NAS box, rather than push from my webserver (so my NAS key is't on my webserver).

Can anybody give me an idea of what the script would look like to do the sqldump and pull the files from the NAS?
 

oguruma

Patron
Joined
Jan 2, 2016
Messages
226
That would work for backing up the site files, but it wouldn't do the sqldump on the webserver for me... My understanding is that I would have to do some kind of script in order to accomplish this.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
but it wouldn't do the sqldump on the webserver for me... My understanding is that I would have to do some kind of script in order to accomplish this.

You would and it would have to be on the webserver. Of course exactly how that is done will depend on what database you are using.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
You would and it would have to be on the webserver.
Not necessarily. SSH lets you run arbitrary commands on the target machine, so you could run something like ssh user@webhost mysqldump database > file.sql from the FreeNAS box followed by whatever rsync task you wanted to run.

Or you could set up the rsync task through the FreeNAS GUI, and set a cron job on the webserver to do the mysqldump 1-2 minutes before the rsync job is scheduled (and put the output of that task somewhere that would be included in the rsync task). Or...
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Status
Not open for further replies.
Top