Compare commits

...

10 Commits

Author SHA1 Message Date
Marc Hoppe
e3e4a6ea3e pbxtest 2023-03-14 20:01:19 +01:00
101ba29d0e pbxnettest 2023-03-01 19:40:08 +01:00
307ae34907 ... 2023-03-01 17:03:15 +01:00
3ba505a5bb ... 2023-03-01 16:49:13 +01:00
3fb0063a0c pbxpcitests 2023-02-23 14:37:19 +00:00
3be1178460 pbxpcitest 2023-02-23 14:37:19 +00:00
4290581abc pbxtest 2022-08-31 09:54:21 +02:00
a280260fd7 vdrcutrec 2021-12-08 18:22:49 +01:00
ed50017f38 Revert "vdrrecpathtonum"
This reverts commit dadb683bc6.
2021-12-08 17:04:48 +01:00
fa8f2e3aaf fv 2021-12-08 17:01:36 +01:00
17 changed files with 312 additions and 56 deletions

View File

@@ -1,8 +1,11 @@
#!/bin/sh
REPOSITORY=pi@pi4.fritz.box:/media/hdext/borg
#REPOSITORY=pi@kodi.fritz.box:/media/hdext/borg
REPOSITORY=marc@vdr.fritz.box:/media/hdext/borg
#REPOSITORY=pi@vdrpi.fritz.box:tmp/mnt/borg
PREFIX=nasdat
if [ "$1" != "--prune" ]; then
borg create -v --stats --progress --compression zlib --one-file-system \
$REPOSITORY::'nasdat-{now:%Y-%m-%d}' \
/dat/books \
@@ -18,7 +21,7 @@ borg create -v --stats --progress --compression zlib --one-file-system \
--exclude '/dat/docu/Download' \
--exclude '*/files_trashbin' \
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

29
backupdir2nas.sh Normal file
View File

@@ -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

View File

@@ -1,31 +1,33 @@
#!/bin/sh
REPOSITORY=pi@pi4:/media/hdext/borg
#REPOSITORY=marc@nas:/dat/bak/borg_mac
REPOSITORY=pi@kodi:/media/hdext/borg
#REPOSITORY=pi@kodi:/media/hdext/borg
#REPOSITORY=marc@vdr.fritz.box:/media/hdext/borg
#REPOSITORY=/Volumes/nifty/bak/borg
borg create -v --stats --progress --compression zlib --one-file-system \
$REPOSITORY::'{hostname}-{now:%Y-%m-%d}' \
/ \
/Volumes/Data \
/System/Volumes/Data \
--exclude '*/tmp/*' \
--exclude '*/tmpfile/*' \
--exclude '*/Temp/*' \
--exclude '/var/tmp/*' \
--exclude '/var/crash/*' \
--exclude '*/var/tmp/*' \
--exclude '*/var/crash/*' \
--exclude '*/.cache/*' \
--exclude '*/cache/*' \
--exclude '*/Caches/*' \
--exclude '*/.ccache/*' \
--exclude '*/Caches/*' \
--exclude '*/mlocate.db*' \
--exclude '/run' \
--exclude '/var/cache/apt/archives/*.deb' \
--exclude '/var/cache/man' \
--exclude '/private/var' \
--exclude '*/run' \
--exclude '*/var/cache/apt/archives/*.deb' \
--exclude '*/var/cache/man' \
--exclude '*/private/var' \
--exclude '/tmp' \
--exclude '/var/tmp' \
--exclude '/Users/marc/tmp' \
--exclude '/Users/marc/Downloads' \
--exclude '*/var/tmp' \
--exclude '*/Users/marc/tmp' \
--exclude '*/Downloads/*' \
--exclude '*/Caches/*' \
--exclude '*/.Trash/*' \
--exclude '*/.Spotlight-*' \
@@ -33,8 +35,9 @@ borg create -v --stats --progress --compression zlib --one-file-system \
--exclude '*/ot_shared_cache' \
--exclude '*/dyld_shared_cache*' \
--exclude '*/Downloads/*' \
--exclude '/System/Volumes/Data/Applications/Xcode.app/*' \
Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly
# 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.

View File

@@ -1,6 +1,7 @@
#!/bin/sh
REPOSITORY=pi@pi4.fritz.box:/media/hdext/borg
#REPOSITORY=pi@kodi.fritz.box:/media/hdext/borg
REPOSITORY=marc@vdr.fritz.box:/media/hdext/borg
#REPOSITORY=pi@vdrpi.fritz.box:tmp/mnt/borg
if [ "$1" != "--prune" ]; then
borg create -v --stats --progress --compression zlib --one-file-system \

View File

@@ -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

View File

@@ -1,8 +1,11 @@
#!/bin/sh
REPOSITORY=pi@pi4.fritz.box:/media/hdext/borg
#REPOSITORY=pi@kodi.fritz.box:/media/hdext/borg
REPOSITORY=marc@vdr.fritz.box:/media/hdext/borg
#REPOSITORY=pi@vdrpi.fritz.box:tmp/mnt/borg
PREFIX=nassrc
if [ "$1" != "--prune" ]; then
borg create -v --stats --progress --compression zlib --one-file-system \
$REPOSITORY::'nassrc-{now:%Y-%m-%d}' \
/dat/src \
@@ -30,7 +33,7 @@ borg create -v --stats --progress --compression zlib --one-file-system \
--exclude '*/staging*/*' \
--exclude '/run'
fi
# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly

48
backuptostick.sh Normal file
View File

@@ -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

3
fv
View File

@@ -4,6 +4,7 @@
name=$1
tempfile=/tmp/fv_recs
videodir=/dat/video/vdr
lstr2dir () {
local lstr=$1
@@ -46,7 +47,7 @@ for i in $(<${tempfile}_3.tmp)
do
x=$(echo $i | awk -F'|' '{printf("%s",$2);}' | sed "s/\r//g" | sed "s/:/#3A/g" | sed "s/\?/#3F/")
f=$(echo $i | awk -F'|' '{printf("%s",$1);}')
s=$(find /video/$x -name "$f*.rec" -exec du -sh {} \; | awk '{ printf("%s", $1); }') # | sed -sh {} \; | sed
s=$(find $videodir/$x -name "$f*.rec" -exec du -sh {} \; | awk '{ printf("%s", $1); }') # | sed -sh {} \; | sed
echo "$x ($s)" >> ${tempfile}_4.tmp
#du -sh /video/$x | sed "s/\/video\///g"
done

16
fvl
View File

@@ -1,15 +1,11 @@
#!/bin/bash
videodir=/dat/video/vdr
vdrdb=/tmp/vdr.db
tofind=$1
files=$(locate -d $vdrdb -i $1 | grep -v .rec)
cmd2nas=~/bin/cmd2nas.sh
ls -l ~/bin/cmd2nas.sh
$cmd2nas "/home/marc/bin/fvl '*$tofind*'"
for f in $files; do
if [ -d $f ]; then
#echo $f
du -sh $f
fi
done

38
pbxnettest Normal file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
#ip=192.168.178.234
ip=172.16.234.234
url=root@$ip
log=$HOME/tmp/pbxnettest_$(date +%y%m%d%H%M%S).log
srcfile=~/Downloads/12.0sp1.zip
sshopt='-i ~/.ssh/cm4'
n=0
i=0
echo "[" > $log
while [ true ]; do
echo -n "."
SECONDS=0
iperf3 -c $ip -t 10 -J >> $log
#scp -q $sshopt $srcfile $url:/dev/null
r=$?
if [ $r -ne 0 ]; then
echo "Error $n"
fi
echo "," >> $log
lasttim=$SECONDS
#echo -n $lasttim
blocktim=$((blocktim+lasttim))
i=$((i+1))
n=$((n+1))
if [ $i -ge 50 ]; then
echo " $(date +%T) $n $blocktim"
i=0
blocktim=0
fi
read -t 1 -n 1 key
if [ "$key" = "x" ]; then
echo "{} ]" >> $log
exit
fi
done

103
pbxpcitest.sh Normal file
View File

@@ -0,0 +1,103 @@
#!/bin/bash
# ip=192.168.178.116
ip=172.16.99.208
url=root@$ip
#url=root@es-system
#broker=192.168.178.25
broker=172.16.170.165
sleeptime=75
#topic_power="cmnd/powplug2/power"
#topic_power="cmnd/plug-b/power"
topic_power="shellies/rw2/whg3/buero/steckdose1/relay/0/command"
log=$HOME/tmp/pbxpcitest_$(date +%y%m%d%H%M%S).log
function stopp
{
echo -e "\n stopped !"
echo "{} ]" >> $log
exit
}
echo "Start (Stopp mit 'x')"
echo "[" >> $log
n=1
while [ true ]; do
mosquitto_pub -h $broker -m "on" -t "$topic_power"
echo -n "$n:on"
#sleep 5
read -t 5 -n 1 key
if [ "$key" = "x" ]; then
stopp
fi
i=0
test="ok"
echo -n " ping"
while [ true ]; do
read -t 0.1 -n 1 key
if [ "$key" = "x" ]; then
stopp
fi
echo -n "."
ping -w 1 -q $ip > /dev/null
r=$?
if [ $r -eq 0 ]; then
break
fi
i=$((i+1))
if [ $i -gt 200 ]; then
echo "Fehler $i !"
test="fail"
break;
fi
done
echo "{ \"time\" : \"$(date +%T)\", \"n\" : $n, \"test\" : \"$test\", \"result\" : $r, \"count\" : $i }," >> $log
echo " $i off"
mosquitto_pub -h $broker -m "off" -t "$topic_power"
read -t 5 -n 1 key
if [ "$key" = "x" ]; then
stopp
fi
n=$((n+1))
done
stopp
exit
while [ no_connect != 0 ]
sleep $sleeptime
echo "$(date) ----------------------------------" | tee -a $log
ssh $url -o ConnectTimeout=3 'cat /etc/release | grep PRODUCT'
if [ $? -eq 0 ]; then
echo ok >> $log
else
echo fail1 >> $log
sleep 10
ssh $url -o ConnectTimeout=3 'cat /etc/release | grep PRODUCT'
if [ $? -eq 0 ]; then
echo ok2 >> $log
else
echo fail2 >> $log
sleep 10
ssh $url -o ConnectTimeout=3 'cat /etc/release | grep PRODUCT'
if [ $? -eq 0 ]; then
echo ok3 >> $log
else
echo fail3 >> $log
sleep 10
ssh $url -o ConnectTimeout=3 'cat /etc/release | grep PRODUCT'
if [ $? -eq 0 ]; then
echo ok4 >> $log
else
echo fail4
fi
fi
fi
fi
mosquitto_pub -h $broker -m "off" -t "$topic_power"
sleep 5
done

23
pbxtypetest.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
url=root@192.168.178.151
broker=192.168.178.25
#topic_power="cmnd/powplug2/power"
topic_power="cmnd/plug-b/power"
log=$HOME/tmp/pbxtypetest.log
while [ true ]; do
mosquitto_pub -h $broker -m "on" -t "$topic_power"
sleep 50
echo "$(date) ----------------------------------" | tee -a $log
ssh $url 'dmesg | grep hwinfo' | tee -a $log
ssh $url 'cat /sys/devices/platform/ff200000.hwinfo/slotmask' | tee -a $log
ssh $url 'cat /etc/release | grep PRODUCT' | tee -a $log
ssh $url 'cat /var/log/agfpbxtype.log' | tee -a $log
mosquitto_pub -h $broker -m "off" -t "$topic_power"
sleep 5
done

View File

@@ -1,3 +1,2 @@
sudo docker run -p 3001:3000 -v /var/lib/grafana:/var/lib/grafana -e "GF_SECURITY_ADMIN_PASSWORD=1234" grafana/grafana
sudo docker run -p 3001:3000 -v /var/lib/grafana:/var/lib/grafana -e "GF_SECURITY_ADMIN_PASSWORD=1234" -d --restart always grafana/grafana

View File

@@ -1,7 +1,9 @@
#!bin/sh
#!/bin/sh
# https://github.com/mxpv/podsync
sudo docker run \
-p 8080:8080 \
-v $(pwd)/data:/app/data/ \
-v $(pwd)/config.toml:/app/config.toml \
-v /srv/podsync/data:/app/data/ \
-v /srv/podsync/config.toml:/app/config.toml \
mxpv/podsync:latest

View File

@@ -1,4 +1,5 @@
srcdir=/dat/audio/auto
srcdir=$1
dstdir=$2
# sudo mount -o uid=marc /dev/sdt1 /media/hdext
rsync -a --no-o --no-p --no-g -L --modify-window 1 --stats --delete --progress $srcdir /media/hdext/
rsync -a --no-o --no-p --no-g -L --modify-window 1 --stats --delete --progress $srcdir $dstdir

15
vdrcutrec Executable file
View File

@@ -0,0 +1,15 @@
recdat=$1
recnam=$2
echo $recdat
echo $recnam
recvdr=`svdrpsend LSTR | grep "$recdat" | grep "$recnam"`
echo $recvdr
recnum=`echo "$recvdr" | sed -E 's/^250[- ]([0-9]+).*/\1/'`
echo starting: svdrpsend EDIT $recnum
svdrpsend EDIT $recnum

View File

@@ -1,25 +1,15 @@
#!/bin/sh
recpath=$1
recdat=$1
recnam=$2
logfile=/tmp/vdrrecpath.log
echo $recdat
echo $recnam
recpathshort=`echo "$recpath" | sed 's|/media/nas/video/vdr/||'`
echo "vdrcut: recpathshort:$recpathshort" > $logfile
recvdr=`svdrpsend LSTR | grep "$recdat" | grep "$recnam"`
echo $recvdr
recname1=`echo "$recpathshort" | sed 's|\.[0-9-]*-[0-9]*\.rec$||' | sed 's/[0-9./-]*$//' | sed 's|/|~|' | sed 's/_/ /g'`
recname=`echo "$recname1" | sed 's/#3A/:/g' | sed 's/#2A/*/g' | sed 's/#2E/./g' | sed 's|#2F|/|g' | sed 's/#22/\\\"/g' | sed 's/#3F/?/g' | sed 's/#27/?/g'`
#:recname=`echo "$recname1" | sed 's/#3A/:/g' | sed 's/#2A/*/g' | sed 's/#2E/./g' | sed 's|#2F|/|g' | sed 's/#3F/?/g' | sed 's/#27/?/g'`
recdate1=`echo "$recpathshort" | awk -F'/' '{ printf("%s\n", $NF); }' | sed 's|\.[0-9-]*-[0-9]*\.rec$||' | sed 's/[-.]/ /g'`
recdate=`echo "$recdate1 00" | gawk '{ dt=mktime($0); print strftime("%d.%m.%y %H:%M", dt) }'`
recnum=`echo "$recvdr" | sed -E 's/^250[- ]([0-9]+).*/\1/'`
echo "vdrcut: Recname: $recname" | tee -a $logfile
echo "vdrcut: recdate: $recdate" | tee -a $logfile
#keyfile= /var/lib/vdr/.ssh/vdrpi_nas
keyfile=/var/lib/vdr/.ssh/vdrpi_nas
echo ssh -i $keyfile marc@nas "~/bin/vdrrecpathtonum \"$recname\" \"$recdate\"" >> $logfile
ssh -i $keyfile marc@nas "~/bin/vdrrecpathtonum \"$recname\" \"$recdate\""
echo "---" >> $logfile
echo starting: svdrpsend EDIT $recnum
svdrpsend EDIT $recnum