安裝目標系統是windows 7
首先看了這篇文章:http://blog.csdn.net/defonds/article/details/7906005
裡面推薦winsw作為註冊服務的工具,的確不錯。該項目首頁在:https://github.com/kohsuke/winsw
使用方法很簡單,下載exe檔案,重新命名為install.exe,然後建立一個install.xml檔案,根據首頁上介紹的填好設定。
運行後的確成功。但是不能在newlisp程式的exec中調用,始終報下面的錯誤
annot start service from the command line or a debugger ...
然後試用.net帶來的intallutil.exe,不行,始終報找不到assembly的錯誤:
Exception occurred while initializing the installation:System.BadImageFormatException: Could not load file or assembly 'file:///c:\cloud_engine\nginx\nginx.exe' or one of its dependencies. The module was expected to contain an assembly manifest..
最後找到這個:http://ng-srvinst.attron.org/
下載壓縮包,解壓後看一下read.me, 非常簡單。
不過要注意ng_srv.xml檔案最後的兩項配置:
<service> <id>nginx</id> <name>nginx</name> <description>nginx</description> <executable>cloud-engine-home\nginx\nginx.exe</executable> <logpath>cloud-engine-home\nginx\logs\</logpath> <logmode>roll</logmode> <depend></depend> <startargument>-p cloud-engine-home\nginx</startargument> <stopargument>-p cloud-engine-home\nginx -s stop</stopargument></service>
-p 後面是Nginx目錄,如果寫成nginx.exe路徑就錯了,會造成nginx 服務無法啟動。
現在newlisp中通過exec調用成功了。