diff options
author | xengineering <mail2xengineering@protonmail.com> | 2021-06-21 12:10:15 +0200 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2021-06-21 12:10:15 +0200 |
commit | d6403e71ab589af94d297afdbd88bea684e7ed3f (patch) | |
tree | fe5567a957ed0a5a9f96f911292c87ce5b8447f8 | |
parent | 963b86e49fad07a3722646b9d7f4b1c09d199eb1 (diff) | |
download | birdscan-d6403e71ab589af94d297afdbd88bea684e7ed3f.tar birdscan-d6403e71ab589af94d297afdbd88bea684e7ed3f.tar.zst birdscan-d6403e71ab589af94d297afdbd88bea684e7ed3f.zip |
Add temporary Solution for Picture Transport
-rw-r--r-- | tmp/birdtransporter.service | 13 | ||||
-rw-r--r-- | tmp/birdtransporter.sh | 14 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tmp/birdtransporter.service b/tmp/birdtransporter.service new file mode 100644 index 0000000..2f45283 --- /dev/null +++ b/tmp/birdtransporter.service @@ -0,0 +1,13 @@ + +[Unit] +Description=A temporary script to sync pictures from birdscan +After=network.target + +[Service] +User=birdscan +Group=birdscan +ExecStart=/usr/bin/birdtransporter + +[Install] +WantedBy=multi-user.target + diff --git a/tmp/birdtransporter.sh b/tmp/birdtransporter.sh new file mode 100644 index 0000000..0cca9dd --- /dev/null +++ b/tmp/birdtransporter.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +while : +do + rsync --remove-source-files -rltgoDv -e 'ssh -p ${SSH_PORT} -i ${SSH_PRIV_KEY_PATH}' ${LOCAL_SOURCE_FOLDER_PATH} ${SSH_REMOTE_USER}@${FILESERVER_IP}:${REMOTE_TARGET_FOLDER_PATH} + if [ $(ls -l ${LOCAL_SOURCE_FOLDER_PATH} | wc -l) -gt 1 ] + then + continue + fi + inotifywait -e create ${LOCAL_SOURCE_FOLDER_PATH} + echo "change detected" + sleep 2 +done + |