-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsdbloop.sh
More file actions
executable file
·52 lines (52 loc) · 1.35 KB
/
sdbloop.sh
File metadata and controls
executable file
·52 lines (52 loc) · 1.35 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#--
# sdb.* v0.2 by B.K aka t3ch -> w4d4f4k at gmail dot com
# sdb.* https://github.com/m5it
# sdb.* Script to sync local with remote database!
# sdb.* Useful for backups or sync because you need it!
#**************** you are welcome **********************
# *** my friend ***
# ***********************
# · synca effortlessly ·
# ·······················
#--
# Used files:
# - sdb.config ( configurations for remote and local db )
# - sdb.sh ( main script that do the job )
# - sdbloop.sh ( Define db names )
#--
source sdb.config
#
for DB in "${DBS[@]}"; do
echo "sdbloop.sh => Parsing DB: "$DB
IFS=';:' read -ra parts <<< "$DB"
CMD="" # Supported commands: -E (exclude tables)
EXC=""
SDB=""
DDB=""
# First part is a flag (e.g., "-E") Exclude table.
if [[ ${parts[0]} == -* ]]; then
#SDB=${TMP#*:}
#DDB=${TMP%%:*}
CMD=${parts[0]} # for future versions
EXC=${parts[1]}
SDB="${parts[2]}"
DDB="${parts[3]}"
#
./sdb.sh "$SDB" "$DDB" "$EXC"
# Default case: split on first colon
else
SDB=${parts[0]}
DDB=${parts[1]}
./sdb.sh "$SDB" "$DDB"
fi
# Debug only
if [[ $DEBUG == true ]]; then
echo "DEBUG configured options: "
echo "CMD: $CMD" # -E ...
echo "EXC: $EXC" # -E:somedata;
echo "SDB: $SDB"
echo "DDB: $DDB"
fi
done
echo "Done!"