我有一个 python 下停止和启动 tomcat 的需求
使用 python 的如下方式启动 tomcat:
1)os.popen('/path/tomcat/bin/startup.sh')
2)subprocess.Popen('/path/tomcat/bin/startup.sh', stdout=subprocess.PIPE)
3)os.system('/path/tomcat/bin/startup.sh')
以上方式都无法启动 tomcat,初步判断是 python 执行 shell 脚本后,shell 关闭导致 startup.sh 被迫关闭。
我得疑问是:
1)shell 脚本 /path/tomcat/bin/startup.sh 也是通过启动后台进程启动的 tomcat,执行完后 shell 应该是可以备关闭的,在 Linux 下执行确实也是这样,但是目前看 python 执行 /path/tomcat/bin/startup.sh 后,tomcat 被关闭了
2)具体 python 应该怎样启动 tomcat,Google 给出的都是以上 3 种方案,亲测无效
使用 python 的如下方式启动 tomcat:
1)os.popen('/path/tomcat/bin/startup.sh')
2)subprocess.Popen('/path/tomcat/bin/startup.sh', stdout=subprocess.PIPE)
3)os.system('/path/tomcat/bin/startup.sh')
以上方式都无法启动 tomcat,初步判断是 python 执行 shell 脚本后,shell 关闭导致 startup.sh 被迫关闭。
我得疑问是:
1)shell 脚本 /path/tomcat/bin/startup.sh 也是通过启动后台进程启动的 tomcat,执行完后 shell 应该是可以备关闭的,在 Linux 下执行确实也是这样,但是目前看 python 执行 /path/tomcat/bin/startup.sh 后,tomcat 被关闭了
2)具体 python 应该怎样启动 tomcat,Google 给出的都是以上 3 种方案,亲测无效