使用Wampserver的按钮启动/停止Tomcat



我安装了一台带有Wampserver 2.0的服务器,通过mod_jk连接器,我设法与Tomcat 6集成(作为Windows服务安装)。为了方便起见,我对 wampmanager 进行了一些更改.ini并且可以使用 WampServer 菜单启动所有服务。见下文:

[Services]
Name: wampapache
Name: wampmysqld
Name: Tomcat6
[StartupAction]
;WAMPSTARTUPACTIONSTART
Action: run; FileName: "D:/wamp/bin/php/php5.3.0/php-win.exe";Parameters: "refresh.php";WorkingDir: "D:/wamp/scripts"; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: Tomcat6; ServiceAction: startresume; Flags: ignoreerrors
;WAMPSTARTUPACTIONEND
[StartAll]
;WAMPSTARTALLSTART
Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors
Action: service; Service: Tomcat6; ServiceAction: startresume; Flags: ignoreerrors
;WAMPSTARTALLEND
[StopAll]
;WAMPSTOPALLSTART
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: Tomcat6; ServiceAction: stop; Flags: ignoreerrors
;WAMPSTOPALLEND
[RestartAll]
;WAMPRESTARTALLSTART
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: service; Service: Tomcat6; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: service; Service: wampapache; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
Action: service; Service: wampmysqld; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
Action: service; Service: Tomcat6; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
;WAMPRESTARTALLEND
[myexit]
;WAMPMYEXITSTART
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: wampmysqld; ServiceAction: stop; Flags: ignoreerrors
Action: service; Service: Tomcat6; ServiceAction: stop; Flags: ignoreerrors
Action:  exit
;WAMPMYEXITEND

但是,我正在升级我的服务器,并尝试在Wampserver 3.0.0中重复这个想法,但它没有奏效。在两个wampmanager中都引用了这些变化吗.ini和wampmanager.tpl(它们具有相同的设置部分),但是当使用菜单启动Wampserver时,Tomcat服务不会启动。

如果我手动启动 Tomcat 服务,集成有效,我唯一的问题是使用 WampServer 菜单一键启动和终止所有服务。

谁能提出什么建议?

在Wampserver的论坛(阅读这里)中交换信息后,设法解决了问题,我在这里分享了我的问题的解决方案。

与 2.0 版本不同,3.0.0 版本更改不会在 wampmanager.tpl 中进行。更改说明如下:

$WAMP_HOME$\wampmanager.conf

在 [service] 标签中为 Tomcat 服务创建了一行(在我的例子中,Tomcat 8.0.30 是作为服务安装的,称为"tomcat8")。

[service]
ServiceTomcat = "tomcat8"

$WAMP_HOME$\scripts\config.inc.php

创建变量到雄猫服务

$c_tomcatService = $wampConf['ServiceTomcat']; 

$WAMP_HOME$\wampmanager.tpl

更改了上面原始帖子中提到的标签,添加了引用Tomcat服务的行

...
[Services]
Name: ${c_tomcatService}
...
[StartupAction]
Action: service; Service: ${c_tomcatService}; ServiceAction: startresume; Flags: ignoreerrors
...
[StartAll]
Action: service; Service: ${c_tomcatService}; ServiceAction: startresume; Flags: ignoreerrors
...
[StopAll]
Action: service; Service: ${c_tomcatService}; ServiceAction: stop; Flags: ignoreerrors
...
[RestartAll]
Action: service; Service: ${c_tomcatService}; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: service; Service: ${c_tomcatService}; ServiceAction: startresume; Flags: ignoreerrors waituntilterminated
...
[myexit]
Action: service; Service: ${c_tomcatService}; ServiceAction: stop; Flags: ignoreerrors

在第一次测试中,没有工作。我发现 Tomcat 服务由 Windows 服务管理器启动,但在通过提示符或通过批处理文件手动调用(拒绝访问错误)时不起作用,即使作为服务器上的管理员也是如此。

Wampserver的论坛建议我使用SetACL(https://helgeklein.com)。 使用以下命令,我能够更改权限:

setacl -on "tomcat8" -ot srv -ace "n:my_login;p:start_stop,read" -actn ace

通过此配置并使用SetACL,我设法启动和停止Tomcat服务以及Wampserver的服务。

相关内容

  • 没有找到相关文章

最新更新