⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 monitoring-services.txt

📁 最新apache的源代码
💻 TXT
字号:
From:    William A. Rowe, Jr. Date:    June 7th '00Subject: service monitoring in Apache 1.3.13The concept for a taskbar monitor has been thrown aroundfor a very long while.  1.3.13 introduced Win9x services,and that added fuel to the mix.  Here are some sidebandobservations I've made for other developers...About Apache as a console, don't start Apache hidden withoutany command line arguments if you want to launch it yourselfin a hidden window (it will do the classic test for AllocConsole/FreeConsole)... drop in some arguments such asthe -f or -r option and it will fly without thinking it is a service under 9x and NT.Rule two, don't use --ntservice as an argument, ever.  Onlythe Windows NT Service Control Manager is allowed to pass thatflag, and only that flag, when it runs Apache.exe.  Do use --ntservice as the sole argument to the executable name if you are installing an Apache NT service yourself.Rule three, use -k start and -n name when maintaining theHKLM/Software/Microsoft/Windows/CurrentVersion/RunServiceslist, since there is no other way for Apache to know what the service is named :)  And look at any 9x installed service's RunServices entry in the registry for the start service semantic.Rule four, use the WinNT Service Control Manager exclusivelyfor starting, stopping and restarting Apache as an NT service.The restart signal is the value 128, as documented in service.h and service.c - this will continue to work in Apache 2.0.  Ifit fails, you are handling an older version (pre 1.3.13) ofApache, and need to stop and then start the service instead.Rule five, use the legacy pid-named events to signal Win9x service Apache to restart and stop the service.  But don'tbother looking for httpd.pid files... you can get the pidright from the hidden service control window.  Apache 1.3.13and 2.x create a hidden window named for the name of the service (without the spaces), with a window class of"ApacheWin95ServiceMonitor", so can use FindWindow to track down running Win9x services.  See the service.c code for how I accomplished this pretty simply in the -k stop/-k restarthandler.Taskbar Monitor App-------------------Basic requirements: a C code application using strictly theWin32 API, and not MFC or other Win32 frameworks.  Could usethe service.c module to share some basic functions.  Thatmodule could be extended in Apache 2.0 to make this all easier.I think we are looking for an external app that simply acts as a monitor or allows a stopped service to be started.  If the user logs off, we loose the monitor app, but installed as a shortcut in the Start group or in the registry keyHKLM/Software/Microsoft/Windows/CurrentVersion/Runwe will be just fine.  I'd like to see the monitor run onlyone instance to monitor all running services, for memoryand resource conservation.I was thinking that the hover/iconbar title would tell them "Test service is running", or "Test service is stopped".If they left click, they could stop or restart, or simplystart if it is stopped.  There could be a preference thateach service doesn't get it's own individual task icon unless it is running, if it is a manual start service (or missing from the RunServices list, which is the equivilant under 9x).If a specific service is set to Auto start or is in the RunServices Win9x registry key, we must show them the stopped icon, of course.  We might also keep the icon for any runningservice that stops abruptly.  But there could be a 'single icon' option for the taskbar icon monitor that says show onlya single status icon, for simplicity if the administrator runsmany Apache services.But I was hoping that any right click would provide a menuof all Apache services with their status.  e.g.  Test service is stopped  Apache_2 service is running  MyWeb service is runningand each would do the logical submenu, same as if thatspecific taskbar icon were left clicked, offering to start oroffering to stop or restart the server, as appropriate.Finally, to identify all installed Apache services, just query the registry key HKLM\SYSTEM\CurrentControlSet\Services for any key that has the ImagePath value of "...\Apache.exe"... (quotesare significant here, if the leading quote is ommitted the entire string ends with the text \Apache.exe - based on Apache's own service installer in every released version.)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -