-1

I have made a cronjob, that takes backup locally - of some diffrent files. But i would like to have them copied to a remote server aswell. The problem is the "remote" server is a NAS server, and im not quite sure how i should go about this.

Inforormation:
* Main server - centOS v7.x
* Backup Server - NAS

Can i do it with just a FTP? or is their some other way i can get access to the NAS server, and remote upload the files?

Mac
  • 115
  • 1
  • 1
  • 9
  • ftp is an option but backging up via ftp might be slow. see if you can mount the NAS via samba (smbfs). – Tux_DEV_NULL Nov 24 '17 at 10:47
  • I can somewhat live with it being a little slow, the files are not that big - we are talking a total of 500-700mb. And both servers being on a pretty good connection. I just want it to sync and delete files older than a specific date – Mac Nov 24 '17 at 10:50
  • Does your NAS allow to connect to it via a SSH connection? You could use rsync to sync your files – Bogdan Stoica Nov 24 '17 at 11:08

1 Answers1

0

so i got it to work with lftp, not the optimal solution - but should work fine for smaller files :)

HOST=''
USER=''
PASS=''
TARGETFOLDER='/xxx/xxx'
SOURCEFOLDER='/xxx/xxx'

function sync_files_to_remove()
{
lftp -f "
set ftp:ssl-force true
set ftp:ssl-protect-data true
set ssl:verify-certificate no
set ftp:ssl-allow off
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --reverse --delete --verbose $SOURCEFOLDER $TARGETFOLDER
bye
"
}
Mac
  • 115
  • 1
  • 1
  • 9