Redis3.2.100
- 安装服务:redis-server --service-install redis.windows.conf
- 卸载服务:redis-server --service-uninstall
winsw服务安装
- 下载地址:Index of releases/com/sun/winsw/winsw/2.9.0 (jenkins-ci.org)
- 常用命令
install
将服务安装到Windows Service Controller.uninstall
卸载服务和上面相反的操作。start
启动服务,该服务必须已经安装。stop
停止服务。stopwait
停止服务并等待,直到它实际上停止为止。restart
重新启动服务。如果该服务当前未运行,则此命令的作用类似于start
。status
检查服务的当前状态。
Nginx1.16.1
-
获取wsw.exe
-
编辑wsw.xml配置
<?xml version="1.0" encoding="UTF-8" ?> <service> <!-- 服务唯一ID --> <id>Nginx</id> <!-- 服务显示名称 --> <name>Nginx</name> <description>Nginx server</description> <!-- 日志路径 --> <logpath>D:\nginx1.16.1\logs</logpath> <!-- 日志模式--> <log mode="roll-by-size"> <sizeThreshold>10240</sizeThreshold> <keepFiles>8</keepFiles> </log> <!-- 服务依赖项,其他服务的id,多个使用逗号分割 <depend></depend> --> <!-- 可执行文件的命令 --> <executable>D:\nginx1.16.1\nginx.exe</executable> <!-- 启动参数 <startargument>-p D:\nginx1.16.1</startargument> --> <stopexecutable>D:\nginx1.16.1\nginx.exe -s stop</stopexecutable> <!-- 停止参数 <stopargument>-p D:\nginx1.16.1</stopargument> --> </service>
-
wsw install(切换到nginx目录进行安装)
SpringBoot
-
编辑批处理命令
// 开始服务脚本 @echo off set port=8086 title 登陆权限验证-%port% rem usebackq可以省略,但可以处理带空格的文件名 rem tokens2表示去1-5个字符,返回给函数体,也可使用,表示第几个字符 rem a为显示声明,代表第一个字符变量,后续的b,c,d,e为隐式声明,代表了后续四个变量 for /f "tokens=1-5" %%a in ('netstat -ano^|findstr ":%port%"') do ( if [%%d] EQU [LISTENING] ( set pid=%%e ) ) if "%pid%" == "" goto start if not "%pid%" == "" goto run :run echo %port% (采集程序运行中)port is opening... rem 为调用批处理时传入的参数,结束服务时调用 if "%1"== "stop" ( taskkill /f /pid %pid% ) pause exit :start echo (开始启动采集程序)starting collect program... javaw -jar D:\server\user-auth\ms-user-auth-1.0-SNAPSHOT.jar echo.Starting Success! exit // 停止服务脚本 echo 关闭服务 call start-nohup.bat stop
-
编辑winsw配置
<?xml version="1.0" encoding="UTF-8" ?> <service> <!-- 服务唯一ID --> <id>UserAuth</id> <!-- 服务显示名称 --> <name>UserAuth</name> <description>进货查验,移动办公的服务</description> <!-- 日志路径 --> <logpath>/logs</logpath> <!-- 日志模式--> <log mode="roll-by-size"> <sizeThreshold>10240</sizeThreshold> <keepFiles>8</keepFiles> </log> <!-- 服务依赖项,其他服务的id,多个使用逗号分割 --> <depend>Redis</depend> <!-- 可执行文件的命令 --> <executable>D:\server\user-auth\start-nohup.bat</executable> <stopexecutable>D:\server\user-auth\stop.bat</stopexecutable> </service>
-
使用winsw安装(winsw install)