Now backed up to the cloud

So spent a few hours yesterday on SSH into the server. So got an account with ‘adrive.com’ which is one of the only ones which is a) cheap and b) allows ftp access, more importantly SFTP access. So created a public / private key pair with ssh-keygen. Uploaded the public key to ‘adrive’ and magically I can now log in with open-ssh. This is handy as it has a batch mode, so you can log in and upload from a bash script. So I modified the backup script to backup to the tmp directory and then copy this to the external drive. Then use open-ssl to encrypt it using another private key. It then logs into the ftp server using SFTP and uploads the file. To find out if the upload was successful was a bit more tricky. Uses ‘stat’ to get the file size of the local file, then uses ‘ls -l’ on the remote file and stores that in a file. I then had to use a series of ‘sed’, ‘grep’ and ‘cut’ commands to get the file size. I dump this to a file and then just compare the two files. It failed multiple times in testing until I got the script right. Satisfaction.

Also bought a new hat.

Leave a Reply

Your email address will not be published. Required fields are marked *