Created
May 25, 2024 19:03
-
-
Save RobCranfill/643bc9c28d031e13a58f267dc934955a to your computer and use it in GitHub Desktop.
Back up data files for WeeWX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# back up weewx | |
# as per https://www.weewx.com/docs/4.10/usersguide.htm#backup | |
# param: $1: archive name (date?) | |
# will create directory in cd | |
# run this as root to only get prompted once for pw (if that) | |
BASE_NAME=$1 | |
echo "Backing up to \"$1\"...." | |
mkdir $BASE_NAME | |
# Configuration | |
cp /etc/weewx/weewx.conf $BASE_NAME/ | |
# Skins and templates ? | |
tar czf $BASE_NAME/skins.tar.gz /etc/weewx/skins | |
# Custom code or extensions ? | |
# nah | |
# Database | |
# this will ask for root permission | |
service weewx stop | |
cp /var/lib/weewx/weewx.sdb $BASE_NAME/ | |
service weewx start | |
tar czf $BASE_NAME/weewx.sdb.tar.gz $BASE_NAME/weewx.sdb | |
rm $BASE_NAME/weewx.sdb | |
# hmmmm.... | |
chown rob:rob $BASE_NAME/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment