We have Centos, there is a directory with sql backups. How we can send those backups to Google Drive using cron schedule?
3 Answers
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
Comments
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.
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()