imghut
💖 Chevereto Fan
If like me you use external Linux SFTP storage (and like me your obsessed with backups ) it's handy to have a cheap remote backup, after 2 days of head scratching I finally figured it out, and it works perfect, here's how using SSH access.
First install rclone on your Linux VPS by following the instructions here (I use Vultr)
https://rclone.org/install/
The last line in the above instructions is to run "rclone config"
So type n
then give it a name in this example we are using “remote”
select 3 for back blaze
At the prompts add your account id and application key from your Backblaze account
leave endpoint blank
type yes this is ok
q to quit
Now make a new script, replace /srv/users/username/ with the path where you want file stored (choose a non public location)
nano /srv/users/username/rclone-cron.sh
nano will open and copy/past this in to the window
/srv/users/username/sftp/public/ will be the path to your images
bucketname is the name of bucket you created in your Backblaze account.
Type ctrl X, then y, then enter to save
now make the file executable
chmod a+x /srv/users/username/rclone-cron.sh
Now put the script in crontab
Type crontab -e
select 2 and nano will open again
copy/past this in to the bottom, this will run the backup hourly
examples of scheduling can be found here
https://code.tutsplus.com/tutorials/scheduling-tasks-with-cron-jobs--net-8800
ctrl X then y then enter to save
all done
if you want to test the script just run
/srv/users/username/rclone-cron.sh
Hopefully someone will find this useful, it really did take 2 days of searching and as I am no Linux pro I have tested 3 times on fresh non production server installs before I used on my working image server, I recommend you do the same just for safety.
First install rclone on your Linux VPS by following the instructions here (I use Vultr)
https://rclone.org/install/
The last line in the above instructions is to run "rclone config"
So type n
then give it a name in this example we are using “remote”
select 3 for back blaze
At the prompts add your account id and application key from your Backblaze account
leave endpoint blank
type yes this is ok
q to quit
Now make a new script, replace /srv/users/username/ with the path where you want file stored (choose a non public location)
nano /srv/users/username/rclone-cron.sh
nano will open and copy/past this in to the window
Code:
#!/bin/bash
if pidof -o %PPID -x "rclone-cron.sh"; then
exit 1
fi
rclone sync /srv/users/username/sftp/public/ remote:bucketname
exit
/srv/users/username/sftp/public/ will be the path to your images
bucketname is the name of bucket you created in your Backblaze account.
Type ctrl X, then y, then enter to save
now make the file executable
chmod a+x /srv/users/username/rclone-cron.sh
Now put the script in crontab
Type crontab -e
select 2 and nano will open again
copy/past this in to the bottom, this will run the backup hourly
Code:
0 * * * * /srv/users/username/rclone-cron.sh >/dev/null 2>&1
examples of scheduling can be found here
https://code.tutsplus.com/tutorials/scheduling-tasks-with-cron-jobs--net-8800
ctrl X then y then enter to save
all done
if you want to test the script just run
/srv/users/username/rclone-cron.sh
Hopefully someone will find this useful, it really did take 2 days of searching and as I am no Linux pro I have tested 3 times on fresh non production server installs before I used on my working image server, I recommend you do the same just for safety.