-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollback.sh
executable file
·53 lines (43 loc) · 1.06 KB
/
rollback.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
#
# Author: mail _^_ AT _^_ wangbo _^_ im
#
#
# Enable strict bash mode
set -euo pipefail
IFS=$'\t\n'
LOG_LEVEL="${LOG_LEVEL:-WARN}"
export LOG_LEVEL
#
# Dirs
SCRIPT_FILE_PATH=`realpath $0`
SCRIPT_DIR_PATH=`dirname "${SCRIPT_FILE_PATH}"`
MAIN_SCRIPT_PATH="${SCRIPT_DIR_PATH}/main.script"
# source common config
for each_i in "${SCRIPT_DIR_PATH}"/include.*.conf; do
if [ -f "$each_i" ]; then . "$each_i"; fi
done
__usage() {
__warn ""
__warn "Usage: ${SCRIPT_FILE_PATH##*/} project_dir"
__warn ""
}
if [ $# -eq 1 ]; then
target_dir="$1"
if [ -d "$target_dir" ]; then
bash "$MAIN_SCRIPT_PATH" "$target_dir" rollback
__warn ""
__warn "Note that target project service is not restarted"
__warn "You should restarted it manually against \"$target_dir\""
__warn ""
else
__fatal "Project directory \"$target_dir\" not exists"
__usage
exit 1
fi
else
__fatal "Incorrect number of arguments"
__usage
exit 1
fi
# vim:set nu rnu list et sr ts=4 sw=4 ft=sh: