Loading

使用srvany.exe将任何程序作为Windows服务运行

使用srvany.exe将任何程序作为Windows服务运行

学习了:http://wangye.org/blog/archives/42/

https://www.cnblogs.com/huangcong/p/5761557.html

 

在windows下也可以把zookeeper注册为服务启动。就是在d:\www下运行:
instsrv.exe zookeeper d:\www\srvany.exe
然后写一个注册表文件。内容如下:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\zookeeper\Parameters]
"Application"="D:\\www\\zookeeper-3.4.12\\bin\\zkServer.cmd"
"AppParameters"=""
"AppDirectory"="D:\\www\\zookeeper-3.4.12"

 =====================================================================

还可以带参数,redis启动的时候带的参数;

cd /d d:\www\mysql5.5\bin
echo install mysql
mysqld -install
net start mysql

cd /d d:\www\
instsrv nginx d:\www\srvany.exe
instsrv php5 d:\www\srvany.exe
instsrv.exe redis d:\www\srvany.exe

regedit -s service.reg

cd d:\www\memcached
memcached -d install
net start memcached

echo "all done"

 

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NGINX\Parameters]
"Application"="d:\\www\\nginx\\nginx.exe"
"AppParameters"=""
"AppDirectory"="d:\\www\\nginx\\"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\redis\Parameters]
"Application"="d:\\www\\redis\\redis-server.exe"
"AppParameters"="d:\\www\\redis\\redis.conf"
"AppDirectory"="d:\\www\\redis\\"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\php5\Parameters]
"Application"="d:\\www\\php-5.6.36\\php-cgi.exe"
"AppParameters"="-b 127.0.0.1:9000 -q"
"AppDirectory"="d:\\www\\php-5.6.36\\"

 

posted @ 2018-05-15 08:18  stono  阅读(270)  评论(0编辑  收藏  举报