首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

XYNTService

Posted on 2006-03-11 17:21  昕旸灿烂  阅读(660)  评论(0)    收藏  举报

http://www.codeproject.com/system/xyntservice.asp

  • XYNTService.exe is the name of the executable for this Windows service program. You may get this Windows service from other websites on the internet, but Code Project is the official place to get the most recent version.
  • You can freely use and modify the source code included with this article. I am aware that there are other utility programs providing almost the same functionality as XYNTService. However, as you will see, XYNTService has more features and it is a lot easier to use (no editing of the registry is required, for example). Here is how to use the program:
    • To install the service, run the following at the command prompt: XYNTService -i.
    • To un-install the service, run the following at the command prompt: XYNTService -u.
  • By default, the installed service will be started automatically when you reboot the computer. You can also start and shutdown the service from the Control Panel or Administrative Tools using the Services option. When the service is started, it will create all the processes you defined in the XYNTService.ini file one by one. When the service is shutdown, it will terminate each of these processes it created in reverse order. The XYNTService.ini file should be placed in the same directory as the executable. Here is a sample of the file:
    • [Settings]
    • ServiceName = XYNTService
    • CheckProcessSeconds = 30
    • [Process0]
    • CommandLine = c:\winnt\system32\notepad.exe
    • WorkingDir= c:\
    • PauseStart= 1000
    • PauseEnd= 1000
    • UserInterface = Yes
    • Restart = Yes
    • [Process1]
    • CommandLine = java.exe MyPackage.MyClass
    • UserInterface = No
    • Restart = No
  • You can bounce (stop and restart) any process defined in the .ini file from the command line. For example, the following command will stop and restart the process defined in the [Process2] section of the .ini file.
    • XYNTService -b 2
  • XYNTService can also be used to start and stop other services from the command line. Here are the commands to start (run) and stop (kill) other services:
    • XYNTService -r NameOfServiceToRun
    • XYNTService -k NameOfServiceToKill
  • In particular, you can use the above commands to start and stop XYNTService from the command line!
  • Important note: Please note that you cannot start XYNTService by running it from the command prompt without any argument.