first commit
This commit is contained in:
commit
bc51c25a43
34
EnterRouterMode.sh
Normal file
34
EnterRouterMode.sh
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SDVOL=/data/UsbDisk1/Volume1
|
||||||
|
USBVOL=/data/UsbDisk2/Volume1
|
||||||
|
DATUM=$(date +%Y%m%d%H%M)
|
||||||
|
|
||||||
|
mkdir -p $USBVOL/tmp
|
||||||
|
|
||||||
|
# Das Script nur aufrufen wenn es einen DCIM Ordner auf der SD gibt
|
||||||
|
if [ -e $SDVOL/DCIM ]; then
|
||||||
|
|
||||||
|
# alten telnetd beenden
|
||||||
|
if [ -e $USBVOL/tmp/telnet.pid ]; then
|
||||||
|
killall telnetd.sh
|
||||||
|
kill $(ps ax | grep telnetd.sh | head -1 | awk '{print $1}')
|
||||||
|
fi
|
||||||
|
|
||||||
|
# neuen telnetd auf port 22 starten logausgabe
|
||||||
|
telnetd -l $USBVOL/telnetd.sh -p 22 &
|
||||||
|
echo "$!" > $USBVOL/tmp/telnet.pid
|
||||||
|
echo $USBVOL/logs/rsync_log_$(date +%Y%m%d%H%M).txt > $USBVOL/tmp/logfilepath.txt
|
||||||
|
|
||||||
|
# LEDs blinken
|
||||||
|
/usr/sbin/pioctl status 2
|
||||||
|
/usr/sbin/pioctl internet 2
|
||||||
|
|
||||||
|
cd $USBVOL
|
||||||
|
$USBVOL/rsync.sh >> $USBVOL/logs/rsync_log_$(date +%Y%m%d%H%M).txt
|
||||||
|
|
||||||
|
# LEDs blinken aus
|
||||||
|
/usr/sbin/pioctl status 3
|
||||||
|
/usr/sbin/pioctl internet 3
|
||||||
|
|
||||||
|
fi
|
BIN
busybox-mipsel
Normal file
BIN
busybox-mipsel
Normal file
Binary file not shown.
BIN
rsync-mips
Normal file
BIN
rsync-mips
Normal file
Binary file not shown.
42
rsync.sh
Normal file
42
rsync.sh
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
ORIG=/data/UsbDisk1/Volume1/DCIM/
|
||||||
|
|
||||||
|
SDFOLDERDATE1=$(stat $ORIG | grep "Change")
|
||||||
|
SDFOLDERDATE2=${SDFOLDERDATE1:8:19}
|
||||||
|
SDFOLDERDATE3=$( echo $SDFOLDERDATE2 | sed "s/://g" | sed "s/ /_/")
|
||||||
|
#echo $SDFOLDERDATE1
|
||||||
|
#echo $SDFOLDERDATE2
|
||||||
|
echo "--------------------------------------------"
|
||||||
|
echo "Backup in Verzeichnis:" $SDFOLDERDATE3
|
||||||
|
echo "--------------------------------------------"
|
||||||
|
|
||||||
|
DEST=/data/UsbDisk2/Volume1/$SDFOLDERDATE3
|
||||||
|
echo $DEST > /data/UsbDisk2/Volume1/tmp/dest.txt
|
||||||
|
mkdir -p $DEST
|
||||||
|
mkdir -p /data/UsbDisk2/Volume1/tmp
|
||||||
|
|
||||||
|
#Ausgabe Auslastung USB Laufwerk
|
||||||
|
echo "Auslastung USB vor Kopieren:"
|
||||||
|
df -h | grep UsbDisk2 | awk '{print "USB Used: " $3"B/"$2"B","("$5")", "Free: " $4"B"}'
|
||||||
|
|
||||||
|
echo "--------------------------------------------"
|
||||||
|
|
||||||
|
#Erstmal die Dateien mit tar kopieren
|
||||||
|
# hierzu eine Liste der Dateien erstellen, welche NICHT kopiert werden sollen
|
||||||
|
# NICHT kopiert werden sollen alle Dateien welche sich bereits im ZIEL befinden
|
||||||
|
|
||||||
|
find $DEST -type f | sed "s|$DEST|.|g" > /data/UsbDisk2/Volume1/tmp/exclude.txt
|
||||||
|
|
||||||
|
cd $ORIG
|
||||||
|
/data/UsbDisk2/Volume1/busybox-mipsel tar c -X /data/UsbDisk2/Volume1/tmp/exclude.txt -f - . | (cd $DEST; tar xvf -)
|
||||||
|
|
||||||
|
echo "--------------------------------------------"
|
||||||
|
# rsync Syncronisation
|
||||||
|
cd /data/UsbDisk2/Volume1
|
||||||
|
./rsync-mips -rhv --size-only --stats $ORIG $DEST
|
||||||
|
|
||||||
|
echo "--------------------------------------------"
|
||||||
|
#Ausgabe Auslastung USB Laufwerk
|
||||||
|
echo "Auslastung USB nach Kopieren:"
|
||||||
|
df -h | grep UsbDisk2 | awk '{print "USB Used: " $3"B/"$2"B","("$5")", "Free: " $4"B"}'
|
30
telnetd.sh
Normal file
30
telnetd.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
sync
|
||||||
|
|
||||||
|
# Script ruft telnetd auf um tail auf Logausgabe zu machen
|
||||||
|
|
||||||
|
# 1. Ausgabe Speicherplatz-Verbrauch
|
||||||
|
|
||||||
|
echo "Auslastung SD / USB:"
|
||||||
|
df -h | grep UsbDisk1 | awk '{print "SD Used: " $3"B/"$2"B","("$5")", "Free: " $4"B"}'
|
||||||
|
df -h | grep UsbDisk2 | awk '{print "USB Used: " $3"B/"$2"B","("$5")", "Free: " $4"B"}'
|
||||||
|
|
||||||
|
# leere Zeile
|
||||||
|
echo " "
|
||||||
|
|
||||||
|
|
||||||
|
# Anzahl der Datein auf SD karte und USB Stick
|
||||||
|
DEST=$(cat /data/UsbDisk2/Volume1/tmp/dest.txt)
|
||||||
|
SDFILES=$(find /data/UsbDisk1/Volume1/DCIM/ -type f | wc -l)
|
||||||
|
USBFILES=$(find $DEST -type f | wc -l)
|
||||||
|
echo "Kopiervorgang: $USBFILES / $SDFILES Dateien"
|
||||||
|
|
||||||
|
# leere Zeile
|
||||||
|
echo " "
|
||||||
|
|
||||||
|
# 2. tail auf die Logdatei
|
||||||
|
LOGFILE=$(cat /data/UsbDisk2/Volume1/tmp/logfilepath.txt)
|
||||||
|
tail $LOGFILE
|
||||||
|
|
||||||
|
exit
|
Loading…
Reference in New Issue
Block a user