diff --git a/SensorSetup.py b/SensorSetup.py index 6a039f4..ddd8ea3 100644 --- a/SensorSetup.py +++ b/SensorSetup.py @@ -96,4 +96,3 @@ class SensorSetup(object): obj = self.genericSensorSetup(name, sensor) connected.append(obj) return connected - diff --git a/ftp.sh b/ftp.sh index af2f583..e7a9bfa 100644 --- a/ftp.sh +++ b/ftp.sh @@ -1,25 +1,33 @@ #!/bin/bash -DIR="/home/USER/weather" -SFTPPASS="PASS OR REPLACE WITH KEY" -SFTPUSER="USER@DOMAIN.TLD" -URL="DOMAIN.TLD/PATH/FILE.EXT" +CONFIG="ftpconfig.xml" +FTP_COMMAND="mput temp* +mput humi* +mput ambi* +mput baro* +quit +" -cd $DIR +if [ ! -f $CONFIG ]; then + echo "configuration file not found, exiting! (see ftpconfig.sample.xml)" + exit 1; +fi +read DIR SFTPUSER URL SFTPPASS < <(xmlstarlet sel -t -v "//dir" -o $'\t' -v "//sftpuser" -o $'\t' -v "//url" -o $'\t' -v "//sftppass" $CONFIG) + +cd $DIR || exit 1 cp records/humi* ftp/ cp records/ambi* ftp/ cp records/temp* ftp/ cp records/baro* ftp/ cd ftp -# Using a plain password here is evil, but in my context sadly needed -# better use key-authentication, and switch the commented lines -#sftp -oBatchMode=no -b - $SFTPUSER < + /home/USER/weather + USER@DOMAIN.TLD + + PROTO://DOMAIN.TLD/PATH/FILE.EXT + diff --git a/move.sh b/move.sh index 6bcb7ea..a916ce2 100644 --- a/move.sh +++ b/move.sh @@ -1,7 +1,4 @@ #!/bin/bash -#mv records/humi* arch/ -#mv records/ambi* arch/ -#mv records/temp* arch/ cd records #echo $1 for f in {temp,humi,ambi,baro}* @@ -11,7 +8,7 @@ do if [ "$day" == "$1" ]; then echo "$f today" else - # echo "$f old, -->move" + echo "$f old, -->move" mv $f ../arch fi done