(self, get)
| 928 | |
| 929 | # Tomcat服务管理 |
| 930 | def start_tomcat(self, get): |
| 931 | version = str(get.version) |
| 932 | s_type = get.type |
| 933 | if version.startswith('tomcat') or version.startswith('Tomcat'): |
| 934 | version = version.replace('tomcat', '').replace('Tomcat', '') |
| 935 | # 判断服务是否正常 |
| 936 | execStr = '/etc/init.d/bttomcat%s stop && /etc/init.d/bttomcat%s start' % (version, version) |
| 937 | start = '/usr/local/bttomcat/tomcat%s/bin/daemon.sh start' % version |
| 938 | stop = '/usr/local/bttomcat/tomcat%s/bin/daemon.sh stop' % version |
| 939 | if s_type == 'start': |
| 940 | ret = self.get_server(version) |
| 941 | if not ret: |
| 942 | pid_path = '/www/server/%s/logs/catalina-daemon.pid' % version |
| 943 | if os.path.exists(pid_path): |
| 944 | os.remove(pid_path) |
| 945 | public.ExecShell(start) |
| 946 | self.start_by_user("/etc/init.d/bttomcat{}".format(version)) |
| 947 | return public.returnMsg(True, '启动成功') |
| 948 | elif s_type == 'stop': |
| 949 | public.ExecShell(stop) |
| 950 | if self.get_server(version): |
| 951 | public.ExecShell(stop) |
| 952 | self.stop_by_user("/etc/init.d/bttomcat{}".format(version)) |
| 953 | return public.returnMsg(True, '关闭成功') |
| 954 | elif s_type == 'reload' or s_type == 'restart': |
| 955 | # public.ExecShell(execStr) |
| 956 | public.ExecShell(stop) |
| 957 | public.ExecShell(start) |
| 958 | return public.returnMsg(True, '重载成功') |
| 959 | else: |
| 960 | return public.returnMsg(False, '类型错误') |
| 961 | |
| 962 | def pendent_tomcat_start(self, get): |
| 963 | ''' |
no test coverage detected