From 4c002afde145ac9aa14b4b4b0b66a55f304f3881 Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 18 Dec 2015 18:14:12 +0800 Subject: [PATCH] fix install bug --- install/next.py | 9 ++++++++- service.sh | 20 ++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/install/next.py b/install/next.py index 95ad3bc1b..b90355f22 100644 --- a/install/next.py +++ b/install/next.py @@ -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__': diff --git a/service.sh b/service.sh index 33b1a95e1..64791a59a 100644 --- a/service.sh +++ b/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 - - - - - -