-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.sh
More file actions
executable file
·46 lines (43 loc) · 868 Bytes
/
main.sh
File metadata and controls
executable file
·46 lines (43 loc) · 868 Bytes
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
#!/usr/bin/env sh
set -e
export BAGCLI_WORKDIR="/backup-cli"
. "$BAGCLI_WORKDIR/common"
cli_help() {
cli_name=${0##*/}
echo "
$cli_name
Brot and Games CLI
Version: $(cat $BAGCLI_WORKDIR/VERSION)
Usage: $cli_name [command]
Commands:
postgres Postgres dump
mariadb Mariadb dump
mongodb MongoDB dump
postgres_dumpall Posgres dumpall
mv Move a dump elsewhere
* Help
"
exit 1
}
cli_log "Exporting config ..."
export $(cat "$BAGCLI_WORKDIR/config" | xargs)
case "$1" in
postgres|p)
"$BAGCLI_WORKDIR/commands/postgres" "$2"
;;
postgres_dumpall|pg_dumpall)
"$BAGCLI_WORKDIR/commands/postgres_dumpall"
;;
mariadb|m)
"$BAGCLI_WORKDIR/commands/mariadb" "$2"
;;
mongodb|mongo)
"$BAGCLI_WORKDIR/commands/mongodb"
;;
mv)
"$BAGCLI_WORKDIR/commands/mv" "$2" "$3"
;;
*)
cli_help
;;
esac