This repository was archived by the owner on Dec 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathjmsctl.sh
More file actions
executable file
·97 lines (89 loc) · 2.39 KB
/
jmsctl.sh
File metadata and controls
executable file
·97 lines (89 loc) · 2.39 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env bash
#
BASE_DIR=$(cd "$(dirname "$0")";pwd)
PROJECT_DIR=${BASE_DIR}
SCRIPT_DIR=${BASE_DIR}/scripts
action=$1
target=$2
cat << "EOF"
__ _____
/ /_ ______ ___ ____ / ___/___ ______ _____ _____
__ / / / / / __ `__ \/ __ \\__ \/ _ \/ ___/ | / / _ \/ ___/
/ /_/ / /_/ / / / / / / /_/ /__/ / __/ / | |/ / __/ /
\____/\__,_/_/ /_/ /_/ .___/____/\___/_/ |___/\___/_/
/_/
EOF
if [ ! -f "$PROJECT_DIR/config.conf" ]; then
echo -e "Error: No config file found."
echo -e "You can run 'cp config_example.conf config.conf', and edit it."
exit 1
fi
source ${PROJECT_DIR}/config.conf
echo -e "\t\t\t\t\t Version: \033[33m $Version \033[0m \n"
function usage() {
echo "JumpServer 部署安装脚本"
echo
echo "Usage: "
echo " jmsctl [COMMAND] ..."
echo " jmsctl --help"
echo
echo "Commands: "
echo " install 安装 JumpServer"
echo " start 启动 JumpServer"
echo " stop 停止 JumpServer"
echo " restart 重启 JumpServer"
echo " status 检查 JumpServer"
echo " uninstall 卸载 JumpServer"
echo " upgrade 升级 JumpServer"
echo " reset 重置组件"
}
function main() {
case "${action}" in
install)
bash ${SCRIPT_DIR}/install.sh
;;
uninstall)
bash ${SCRIPT_DIR}/uninstall.sh
;;
upgrade)
bash ${SCRIPT_DIR}/upgrade.sh
;;
start)
bash ${SCRIPT_DIR}/start.sh
;;
stop)
bash ${SCRIPT_DIR}/stop.sh
;;
restart)
bash ${SCRIPT_DIR}/stop.sh
bash ${SCRIPT_DIR}/start.sh
;;
status)
bash ${SCRIPT_DIR}/install_status.sh
;;
reset)
if [ ! $target ]; then
echo -e "Usage: jmsctl reset COMMAND\n"
echo -e "Commands:"
echo -e " all 重置所有组件"
echo -e " core 重置 core"
echo -e " koko 重置 koko"
echo -e " guacamole 重置 guacamole"
exit 1
else
bash ${SCRIPT_DIR}/reset.sh $target
fi
;;
--help)
usage
;;
-h)
usage
;;
*)
echo -e "jmsctl: unknown COMMAND: '$action'"
echo -e "See 'jmsctl --help' \n"
usage
esac
}
main