-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathupdate.cloud
More file actions
39 lines (29 loc) · 1.03 KB
/
Copy pathupdate.cloud
File metadata and controls
39 lines (29 loc) · 1.03 KB
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
35
36
37
#!/bin/sh
###############################################################################
. ${HOME}/.config/SmokeScreen/smokescreen.conf
# If script is already running; abort.
if pidof -o %PPID -x "$(basename "$0")"; then
echo "$(date "+%d.%m.%Y %T") INFO: $(basename "$0") already in progress. Aborting."
exit 3
fi
echo "$(date "+%d.%m.%Y %T") INFO: Starting Upload..."
find "$localdir" -type f |
while read n; do
destpath="$(dirname "$n" | sed -e s@$localdir@@)"
# Skip processing files named like the below
case "${n}" in
(*.partial~) continue ;;
(*_HIDDEN~) continue ;;
(*.QTFS) continue ;;
(*.fuse*) continue ;;
esac
echo "$(date "+%d.%m.%Y %T") INFO: Processing file: ${n}"
# If file is opened by another process, wait until it isn't.
while [ $(lsof "$n" >/dev/null 2>&1) ]; do
echo "File in use. Retrying in 10 seconds."
sleep 10
done
echo "$(date "+%d.%m.%Y %T") INFO: copy to primary cloud storage"
${rclonebin} copy ${rcloneuploadoptions} "$n" "${primaryremote}:${cloudsubdir}${destpath}" 2>&1
done
exit 0