-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrontend.sh
More file actions
executable file
·61 lines (50 loc) · 828 Bytes
/
frontend.sh
File metadata and controls
executable file
·61 lines (50 loc) · 828 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
usage() {
cat 1>&2 <<EOF
usage: frontend.sh (command [args] | help)
Available commands:
slave : Replication slave
help : Prints this help message
For command-specific usage instructions, run frontend.sh command --help
EOF
}
process_args() {
# Poor man's path expansion in argument
while [ $# -gt 0 ]; do
if [ -e "$1" ]; then
readlink -f "$1"
else
echo "$1"
fi
shift
done
}
if [ $# -lt 2 ]; then
usage
exit 1
fi
if [ ! -e `pwd`/env ]; then
echo "Please provide the environment variables file './env'" 1>&2
exit 1
fi
. `pwd`/env
prog="$1"
shift
args=`process_args $@`
case "$prog" in
help|--help|-h)
usage
exit 0
;;
slave)
cd db/slave
./slave.sh $args
;;
master)
cd db/master
./master.sh $args
;;
*)
usage
;;
esac