Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
e476cab2
Commit
e476cab2
authored
7 years ago
by
wojiushixiaobai
Committed by
老广
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新自动升级脚本 (#1250)
parent
b074bd8f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
30 deletions
+19
-30
upgrade.sh
utils/upgrade.sh
+19
-30
No files found.
utils/upgrade.sh
View file @
e476cab2
#!/bin/bash
#!/bin/bash
if
[
!
-d
"/opt/py3"
]
;
then
if
grep
-q
'source ~/.autoenv/activate.sh'
~/.bashrc
;
then
echo
-e
"
\0
33[31m python3虚拟环境不是默认路径
\0
33[0m"
echo
-e
"
\0
33[31m 正在自动载入 python 环境
\0
33[0m"
ps
-ef
|
grep
jumpserver/tmp/beat.pid |
grep
-v
grep
if
[
$?
-ne
0
]
then
echo
-e
"
\0
33[31m jumpserver未运行,请到jumpserver目录使用 ./jms start all -d 启动
\0
33[0m"
exit
0
else
echo
-e
"
\0
33[31m 正在计算python3虚拟环境路径
\0
33[0m"
fi
py3pid
=
`
ps
-ef
|
grep
jumpserver/tmp/beat.pid |
grep
-v
grep
|
awk
'{print $2}'
`
py3file
=
`
cat
/proc/
$py3pid
/cmdline
`
py3even
=
`
echo
${
py3file
%/bin/python3*
}
`
echo
-e
"
\0
33[31m python3虚拟环境路径为
$py3even
\0
33[0m"
source
$py3even
/bin/activate
else
else
source
/opt/py3/bin/activate
echo
-e
"
\0
33[31m 不支持自动升级,请参考 http://docs.jumpserver.org/zh/docs/upgrade.html 手动升级
\0
33[0m"
exit
0
fi
fi
source
~/.bashrc
cd
`
dirname
$0
`
/
&&
cd
..
&&
./jms stop
cd
`
dirname
$0
`
/
&&
cd
..
&&
./jms stop
jumpserver_backup
=
/tmp/jumpserver_backup
$(
date
-d
"today"
+
"%Y%m%d_%H%M%S"
)
jumpserver_backup
=
/tmp/jumpserver_backup
$(
date
-d
"today"
+
"%Y%m%d_%H%M%S"
)
...
@@ -29,21 +19,20 @@ echo -e "\033[31m 是否需要备份Jumpserver数据库 \033[0m"
...
@@ -29,21 +19,20 @@ echo -e "\033[31m 是否需要备份Jumpserver数据库 \033[0m"
stty
erase ^H
stty
erase ^H
read
-p
"确认备份请按Y,否则按其他键跳过备份 "
a
read
-p
"确认备份请按Y,否则按其他键跳过备份 "
a
if
[
"
$a
"
==
y
-o
"
$a
"
==
Y
]
;
then
if
[
"
$a
"
==
y
-o
"
$a
"
==
Y
]
;
then
echo
-e
"
\0
33[31m 正在备份数据库
\0
33[0m"
echo
-e
"
\0
33[31m 正在备份数据库
\0
33[0m"
echo
-e
"
\0
33[31m 请手动输入数据库信息
\0
33[0m"
echo
-e
"
\0
33[31m 请手动输入数据库信息
\0
33[0m"
read
-p
'请输入Jumpserver数据库ip:'
DB_HOST
read
-p
'请输入Jumpserver数据库ip:'
DB_HOST
read
-p
'请输入Jumpserver数据库端口:'
DB_PORT
read
-p
'请输入Jumpserver数据库端口:'
DB_PORT
read
-p
'请输入Jumpserver数据库名称:'
DB_NAME
read
-p
'请输入Jumpserver数据库名称:'
DB_NAME
read
-p
'请输入有权限导出数据库的用户:'
DB_USER
read
-p
'请输入有权限导出数据库的用户:'
DB_USER
read
-p
'请输入该用户的密码:'
DB_PASSWORD
read
-p
'请输入该用户的密码:'
DB_PASSWORD
mysqldump
-h
$DB_HOST
-P
$DB_PORT
-u
$DB_USER
-p
$DB_PASSWORD
$DB_NAME
>
/
$jumpserver_backup
/
$DB_NAME
$(
date
-d
"today"
+
"%Y%m%d_%H%M%S"
)
.sql
||
{
mysqldump
-h
$DB_HOST
-P
$DB_PORT
-u
$DB_USER
-p
$DB_PASSWORD
$DB_NAME
>
/
$jumpserver_backup
/
$DB_NAME
$(
date
-d
"today"
+
"%Y%m%d_%H%M%S"
)
.sql
||
{
echo
-e
"
\0
33[31m 备份数据库失败,请检查输入是否有误
\0
33[0m"
echo
-e
"
\0
33[31m 备份数据库失败,请检查输入是否有误
\0
33[0m"
exit
1
exit
1
}
}
echo
-e
"
\0
33[31m 备份数据库完成
\0
33[0m"
echo
-e
"
\0
33[31m 备份数据库完成
\0
33[0m"
else
else
echo
-e
"
\0
33[31m 已取消备份数据库操作
\0
33[0m"
echo
-e
"
\0
33[31m 已取消备份数据库操作
\0
33[0m"
fi
fi
git pull
&&
pip
install
-r
requirements/requirements.txt
&&
cd
utils
&&
sh make_migrations.sh
git pull
&&
pip
install
-r
requirements/requirements.txt
&&
cd
utils
&&
sh make_migrations.sh
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment