-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScriptA1.sh
34 lines (34 loc) · 843 Bytes
/
ScriptA1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# this script sync the cloud content to the archive server
# Read the foldernames from Arguments
# logging will be done in the actual path
qpath=$1
dpath=$2
#LOG=$0.log
LOG=Script.log
if [ -d "log" ];then LOG="log/$LOG";fi
# check if fhemcl exists
file=fhemcl.sh
{
date
if [ ! -e $file ]
then
echo "$file is missing"
wget https://raw.githubusercontent.com/heinz-otto/fhemcl/master/$file
chmod +x $file
fi
# mount, sync and trigger
mount "$qpath"
mount "$dpath"
# S* will copy all files and folders with S, folders will be created in $dpath if not exist
# set Status in FHEM
# use more rsync lines for different folders
if rsync -a --delete ${qpath}/S* ${dpath}
then
bash fhemcl.sh 8083 "set Sicherung SyncEnde"
else
bash fhemcl.sh 8083 "set Sicherung ERROR_A1"
fi
umount "$qpath"
umount "$dpath"
} >> $LOG 2>&1