mirror of https://github.com/jumpserver/jumpserver
fix install bug
parent
caa0e29564
commit
4c002afde1
|
@ -47,18 +47,25 @@ class Setup(object):
|
|||
def _create_admin(self):
|
||||
db_add_user(username=self.admin_user, password=self.admin_pass, role='SU', name='admin', groups='',
|
||||
admin_groups='', email='admin@jumpserver.org', uuid='MayBeYouAreTheFirstUser', is_active=True)
|
||||
os.system('useradd %s' % self.admin_user)
|
||||
os.system('id %s || useradd %s' % (self.admin_user, self.admin_user))
|
||||
|
||||
@staticmethod
|
||||
def _cp_zzsh():
|
||||
os.chdir(jms_dir)
|
||||
shutil.copy('zzjumpserver.sh', '/etc/profile.d/')
|
||||
|
||||
@staticmethod
|
||||
def _run_service():
|
||||
os.system('sh %s start' % os.path.join(jms_dir, 'service.sh'))
|
||||
color_print('安装成功,请访问web .')
|
||||
|
||||
def start(self):
|
||||
print "开始安装Jumpserver, 要求环境为 CentOS 6.5 x86_64"
|
||||
self._sync_db()
|
||||
self._input_admin()
|
||||
self._create_admin()
|
||||
self._cp_zzsh()
|
||||
self._run_service()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
20
service.sh
20
service.sh
|
@ -7,7 +7,7 @@
|
|||
# Date: 2015-04-12
|
||||
# Version: 2.0.0
|
||||
# Site: http://www.jumpserver.org
|
||||
# Author: jumpserver group
|
||||
# Author: Jumpserver Team
|
||||
|
||||
. /etc/init.d/functions
|
||||
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin
|
||||
|
@ -26,17 +26,16 @@ start() {
|
|||
success "$jump_start"
|
||||
else
|
||||
daemon python $base_dir/manage.py runserver 0.0.0.0:80 &>> /tmp/jumpserver.log 2>&1 &
|
||||
daemon python $base_dir/log_handler.py &> /dev/null 2>&1 &
|
||||
cd $base_dir/websocket/;daemon node index.js &> /dev/null 2>&1 &
|
||||
daemon python $base_dir/run_websocket.py &> /dev/null 2>&1 &
|
||||
sleep 2
|
||||
|
||||
echo -n "$jump_start"
|
||||
nums=0
|
||||
for i in manage.py log_handler.py index.js;do
|
||||
ps aux | grep "$i" | grep -v 'grep' &> /dev/null && let nums+=1
|
||||
for i in manage.py run_websocket.py;do
|
||||
ps aux | grep "$i" | grep -v 'grep' &> /dev/null && let nums+=1 || echo "$i not running"
|
||||
done
|
||||
|
||||
if [ "x$nums" == "x3" ];then
|
||||
if [ "x$nums" == "x2" ];then
|
||||
success "$jump_start"
|
||||
touch "$lockfile"
|
||||
echo
|
||||
|
@ -44,7 +43,6 @@ start() {
|
|||
failure "$jump_start"
|
||||
echo
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
@ -56,7 +54,7 @@ stop() {
|
|||
echo -n $"Stopping ${PROC_NAME} service:"
|
||||
|
||||
if [ -e $lockfile ];then
|
||||
ps aux | grep -E 'manage.py|log_handler.py|index.js' | grep -v grep | awk '{print $2}' | xargs kill -9 &> /dev/null
|
||||
ps aux | grep -E 'manage.py|run_websocket.py' | grep -v grep | awk '{print $2}' | xargs kill -9 &> /dev/null
|
||||
ret=$?
|
||||
|
||||
if [ $ret -eq 0 ]; then
|
||||
|
@ -104,9 +102,3 @@ esac
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue