go windows-services
【摘要】 参考:http://blog.technololist.org/2017/06/09.htmlhttps://raw.githubusercontent.com/Technololist/golang-http-windows-service/master/websvc.gohttps://github.com/golang/sys/blob/master/windows/svc/examp...
参考:
http://blog.technololist.org/2017/06/09.html
https://raw.githubusercontent.com/Technololist/golang-http-windows-service/master/websvc.go
https://github.com/golang/sys/blob/master/windows/svc/example/service.go
https://godoc.org/golang.org/x/sys/windows/svc/example
https://github.com/golang/go/wiki/WindowsDLLs
https://www.jianshu.com/p/632ffea266f3
https://chai2010.cn/post/2018/window-service/
https://groups.google.com/forum/#!topic/golang-nuts/66RXNMQ1auU
bat检测服务是否存在和启动
@Echo Off Set ServiceName=xxx SC QUERY "%ServiceName%" > NUL IF ERRORLEVEL 1060 GOTO MISSING ECHO EXISTS GOTO EXIST :MISSING ECHO SERVICE MISSING BEGIN INSTALLL IT REM xxxx install :EXIST SC queryex "%ServiceName%"|Find "STATE"|Find /v "RUNNING">Nul&&( echo %ServiceName% not running echo Start %ServiceName% Net start "%ServiceName%">nul||( Echo "%ServiceName%" wont start exit /b 1 ) echo "%ServiceName%" started REM start chrome https://localhost:8088/ exit /b 0 )||( echo "%ServiceName%" working REM start chrome https://localhost:8088/ exit /b 0 )
bat设置服务自启动
sc config “xxx” start= auto
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)