I run a simple script with LFTP via a cron job at a time when I know the 
data base isn't being touched, the script backs up the sdb and keeps the 
last 30 days.  It backs up to my UNRAD server, but could be used for other 
FTP destinations.  It also backs up my user and /etc/weewx directory.

I'm sure there are more elegant solutions but this seems to work and was 
easy to implement

On Tuesday, January 22, 2019 at 11:31:20 PM UTC-7, Scott Grayban wrote:
>
> How is everyone doing backups for weewx.sdb ?
>
> I thought about doing a aws backup using a fuse setup.
>
> Are there easier ways to do this ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
!/bin/bash
#This script zips and backs up to web site
#Following line added to prevent "TERM environment variable not set" error

#First declare varibles

DATE=$(date +%y%m%d)
RDATE=$(date +%y%m%d -d "30 days ago")

export TERM=${TERM:-dumb}
clear

#echo "Backing up weewx.sdb"

#Move to the Database directory
cd /var/lib/weewx/

#Copy Database to a temp file with todays date
cp weewx.sdb weewx.cpy.$DATE

#Zip the temp file 
gzip weewx.cpy.$DATE

#Use LFTP to move the file off to storage and delete the 30 day old backup
lftp -e "cd user/Backup/weewxbu/;mput weewx.cpy.*;mrm weewx.cpy.$RDATE.gz; bye" -u username,password destIP

#Backup the /etc/weewx/ directory while we are here
lftp -e "mirror -R /etc/weewx/ /mnt/user/Backup/weewxbu/weewxconfig/; bye" -u username,password destIP

#And the User extensions
lftp -e "mirror -R /usr/share/weewx/user/ /mnt/user/Backup/weewxbu/weewxuser/; bye" -u username,password destIP

#Clean up the temp files
rm weewx.cpy.*

# echo "Done - weewx.sdb zipped and uploaded to website"

Reply via email to