-
Notifications
You must be signed in to change notification settings - Fork 1
/
switch.sh
executable file
·39 lines (31 loc) · 1 KB
/
switch.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
#!/usr/bin/env bash
# Getting current script path
pushd `dirname $0` > /dev/null
switchPath=`pwd -P`
popd > /dev/null
. ${switchPath}/.env
. ${switchPath}/helpers/colors.sh
. ${switchPath}/helpers/getOptForSwitch.sh
info "Switching to ${bold}${otherColor}${other}${reset}... "
projectPath=${projectsPath}/${project}/${instance}/${other}
currentInstancePath=${projectsPath}/${project}/${instance}/${app}
if [[ -d ${projectPath} ]]; then
cd ${projectPath}
else
error "No such file or directory: ${projectPath}"
exit 1
fi
warn "Trying to update and restart another instance"
if [[ -f ${projectPath}/restart.sh ]]; then
. ${projectPath}/restart.sh
else
error "No such file or directory: ${projectPath}/restart.sh"
exit 1
fi
. ${switchPath}/actions/nginxSwitchConfig.sh
info "Stopping ${app} instance"
cd ${currentInstancePath}
. ./stop.sh
success "Done!"
info "Project ${bold}${project}${reset} for instance ${bold}${instance}${reset} is on ${otherColor}${other}${reset} point."
info "Try it out!"