31

We have Centos, there is a directory with sql backups. How we can send those backups to Google Drive using cron schedule?

Kara
  • 6,115
  • 16
  • 50
  • 57
Serge
  • 341
  • 1
  • 4
  • 7

3 Answers3

7

The hack is to use Google Colab then mount google drive to it. After that, you can use ssh to access google collab file system as well as access mounted google drive.

I have written a python notebook here and tried it with success. https://gist.github.com/bikcrum/f9d4cfb0c40dff23329b89cd664d4964

bikram
  • 7,127
  • 2
  • 51
  • 63
5

GDCP should work as long as you authenticate the user for cron with the interactive cli.

https://github.com/ctberthiaume/gdcp

... I am using this now to transfer thousands of mp3 files from a ubuntu vps to google drive.

dovidweisz
  • 1,215
  • 13
  • 24
  • Any version of GDCP for windows ? – tensor Dec 25 '16 at 04:02
  • This script is 4 years old as of this writing and the install instructions don't work for me. I think Google API changed its tool causing an incompatiblity – Neil Sep 24 '20 at 10:05
-2

I was able to do it thanks to the paramiko package:

!pip install paramiko
import paramiko

ssh = paramiko.SSHClient()
# automatically add keys without requiring human intervention
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(url, port, username, password)
ftp_client = ssh.open_sftp()
ftp_client.get('/home/covam/CEMAI/data/results/output1805to0206_rawShiptype.csv', 'data.csv')
ftp_client.close()
ssh.close()