From 3fb0063a0cb57504d9755a6b2d57d982b0c35b24 Mon Sep 17 00:00:00 2001 From: Marc Hoppe Date: Thu, 23 Feb 2023 14:35:01 +0000 Subject: [PATCH] pbxpcitests --- backupdir2nas.sh | 29 ++++++++++++++++++++++++++++ backuproot2nas.sh | 1 + backuptostick.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++++ pbxnettest | 28 +++++++++++++++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 backupdir2nas.sh create mode 100644 backuptostick.sh create mode 100644 pbxnettest diff --git a/backupdir2nas.sh b/backupdir2nas.sh new file mode 100644 index 0000000..9caa087 --- /dev/null +++ b/backupdir2nas.sh @@ -0,0 +1,29 @@ +#!/bin/sh +REPOSITORY=marc@nas:/dat/bak/borg +DIR=/media/hdext + +REPONAME=sd32pi3 +if [ "$1" != "--prune" ]; then +borg create -v --stats --progress --compression zlib --one-file-system \ + $REPOSITORY::"$REPONAME-{now:%Y-%m-%d}" \ + $DIR \ + --exclude '*/tmp/*' \ + --exclude '*/tmpfile/*' \ + --exclude '/var/tmp/*' \ + --exclude '/var/crash/*' \ + --exclude '*/.cache/*' \ + --exclude '*/cache/*' \ + --exclude '*/.ccache/*' \ + --exclude '*/mlocate.db*' \ + --exclude '*/Downloads/*' \ + --exclude '/run' +fi + + + +# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly +# archives of THIS machine. The '{hostname}-' prefix is very important to +# limit prune's operation to this machine's archives and not apply to +# other machine's archives also. +borg prune -v --stats $REPOSITORY --prefix '{hostname}-' \ + --keep-daily=7 --keep-weekly=4 --keep-monthly=20 diff --git a/backuproot2nas.sh b/backuproot2nas.sh index 3672272..a1e5c79 100644 --- a/backuproot2nas.sh +++ b/backuproot2nas.sh @@ -13,6 +13,7 @@ borg create -v --stats --progress --compression zlib --one-file-system \ --exclude '*/cache/*' \ --exclude '*/.ccache/*' \ --exclude '*/mlocate.db*' \ + --exclude '*/Downloads/*' \ --exclude '/run' fi diff --git a/backuptostick.sh b/backuptostick.sh new file mode 100644 index 0000000..06e923b --- /dev/null +++ b/backuptostick.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +#REPOSITORY=/media/mhoppe/KEY/bak/borg +#REPOSITORY=/media/stick/bak/borg +REPOSITORY=/media/hdext/bak/borg +name=es + +prefix="buero-$name-{hostname}-" +echo $prefix +echo $REPOSITORY::$prefix{now:%Y-%m-%d} + + + +if [ "$1" != "--prune" ]; then + borg create -v --stats --progress --compression auto,lzma --noatime \ + $REPOSITORY::$prefix{now:%Y-%m-%d-%H:%M:%S} \ + ssh://buero:/home/mhoppe/proj/$name/ \ + --exclude '*/dl/' \ + --exclude '*/update/' \ + --exclude '*/build*/' \ + --exclude '*/dest/' \ + --exclude '*/dsp/ti' \ + --exclude '*/lm_tkhs/source/user/opensource' \ + --exclude '*/sdcard/' \ + --exclude '*/staging/' \ + --exclude '*/rootfs/' \ + --exclude '*/output_files/' \ + --exclude '*/synthesis/' \ + --exclude '*/sourcemirror/' \ + --exclude '*/downloads/' \ + --exclude '*/sstate-cache/' \ + --exclude '*/yocto-dl-sources.git/' \ + --exclude '*/tmp*' \ + --exclude '*/alt/' \ + --exclude '*/*sstate/' \ + --exclude '*/sstate-cache/' \ + +fi + +# + +# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly +# archives of THIS machine. The '{hostname}-' prefix is very important to +# limit prune's operation to this machine's archives and not apply to +# other machine's archives also. +borg prune -v --stats $REPOSITORY --prefix $prefix \ + --keep-hourly=10 --keep-daily=7 --keep-weekly=4 --keep-monthly=20 + diff --git a/pbxnettest b/pbxnettest new file mode 100644 index 0000000..64a955c --- /dev/null +++ b/pbxnettest @@ -0,0 +1,28 @@ +#!/bin/bash + +ip=192.168.178.234 +url=root@$ip +log=$HOME/tmp/pbxnettest_$(date +%y%m%d%H%M%S).log +srcfile=~/tmp/update-image-tfepi-tfepi.swu + +n=0 +i=0 + +while [ true ]; do + echo -n "." + scp -q $srcfile $url:/dev/null + r=$? + if [ $r -ne 0 ]; then + echo "Error $n" | tee -a $log + fi + i=$((i+1)) + n=$((n+1)) + if [ $i -ge 100 ]; then + i=0 + echo " $(date +%T) $n" | tee -a $log + fi + read -t 1 -n 1 key + if [ "$key" = "x" ]; then + exit + fi +done \ No newline at end of file