Changes between Version 2 and Version 3 of Windows_startstop_Service


Ignore:
Timestamp:
01/30/12 08:23:16 (10 years ago)
Author:
branden
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Windows_startstop_Service

    v2 v3  
     1[[Page Outline]] 
     2 
     3= Earthworm Windows Service = 
     4 
     5(last revised 11 September, 2009) 
     6 
     7Readme for startstop_service[[BR]] 
     8---------------------------- 
     9 
     10Service functionality added by:[[BR]] 
     11Mark Morrison[[BR]] 
     12USGS - Golden, CO[[BR]] 
     13 
     14(Some additional edits or comments in these docs by Stefan Lisowski) 
     15 
     16Setup of startstop_service (Follow these instructions carefully.)[[BR]] 
     17-------------------------- 
     18 
     19startstop_service is identical to the old startstop_nt, except that it runs as a Windows service. This means that the parameters are all the same - read from startstop_nt.d - but that startstop isn't just executed from a command window or via the scheduler. Note that this version is taken from startstop_nt, so I haven't compiled or tested any of this under Solaris or other systems. I believe it's generally felt, however, that these modifications don't apply to Solaris. 
     20 
     21To install startstop_service as a service, do the following: 
     22 
     23- Open a command window. Switch to the directory containing the startstop executable (if it's not already in the Windows path). 
     24 
     25- Type: startstop_service -install[[BR]] 
     26This will install the service. You should get a message saying that installation was successful. 
     27 
     28- Open the Services Control Panel. (It's under Control Panel->Administrative Tools->Services.) You should see something listed as "Earthworm start-stop". Verify that this service is set to run in Automatic mode (meaning it automatically starts after a reboot, without waiting for user intervention.) 
     29 
     30- By default, startstop is set to run as the "Local Service" account. We need to change this to run as the Administrator, or else any Earthworm rings won't be accessible to other users, and typing "status" won't work. To change the user the service runs under, Select the Properties of the startstop service (double-clicking or selecting Properties from the toolbar). Select the Log On tab, select This account, and select Browse. For Win2000 machines, select the Administrator account from the list, then click OK. Type in the password twice, and click OK again. For WinXP machines, select Advanced, then click Find Now. The listbox at the bottom should show all the users locally set up on that computer. Select the Administrator, then click OK twice. Now type in the Administrator password twice, then click OK again. 
     31 
     32NOTE: This whole rigamarole means that whenever the Administrator password is changed on a machine running startstop, the password must be changed again from the Services control panel. 
     33 
     34- There's no way I've been able to find that allows environment variables to be loaded via ew_nt.cmd (or a similar file) before startstop runs. So, any environment variables required for Earthworm functionality have to be loaded systemwide before starting the startstop service. To set environment variables, select the System control panel, select the Advanced tab, and select Environment Variables. Under the "System variables" window (NOT the "user variables for XXX User" window), make sure that any environment variables you'll need are defined here. A typical subset may include:[[BR]] 
     35- EW_HOME[[BR]] 
     36- EW_INSTALLATION[[BR]] 
     37- EW_LOG[[BR]] 
     38- EW_PARAMS[[BR]] 
     39- SYS_NAME[[BR]] 
     40- TZ[[BR]] 
     41In addition, make sure \earthworm\bin directory (or whichever directory contains your earthworm binaries) is included somewhere in the "Path" variable. Once these are set, click OK, and reboot the machine. 
     42 
     43(Note that setting the Timezone Here to UTC may affect how other non-earthworm applications on your machine keep track of and display time.) 
     44 
     45- If you didn't have to change any environment variables and reboot, you can now start the startstop service by clicking Start from the Services Control Panel (the triangle "Play" button). If you reboot, the service will start automatically. 
     46 
     47Notes on running startstop_service[[BR]] 
     48---------------------------------- 
     49 
     50Apart from running as a Windows service, startstop_service behaves just as startstop_nt. One interesting note is that if you select startstop_service in the Services control panel and click Stop or Restart, then startstop will attempt to shut down all applications attached to its ring via an Earthworm TERMINATE message. 
     51 
     52If you want to look at the Status of Earthworm, or if you want to Restart an Earthworm module or Reconfigure Earthworm's modules and rings, and you aren't logged in as Administrator, you can either use StartstopConsole, or you can do the following if you know the Administrator password: (Instructions for Windows XP, but may work on other versions of Windows. See below for Vista.):[[BR]] 
     53- Go to the Windows Start menu, and choose "Run"[[BR]] 
     54- Type the following: 
     55 
     56{{{ 
     57runas /user:YOUR_MACHINE_NAME_HERE\administrator cmd 
     58}}} 
     59 
     60- This will open up a command window which should be able to connect to the running Earthworm, and thus allow you to type "restart", "reconfigure", "status", "pidpau" or "pau" here. 
     61 
     62- To view what's going on in Vista or Windows Server 2008 
     63 
     64StartstopConsole won't work in Vista, nor will "runas" give you access to the session zero.[[BR]] 
     65- Beforehand, add 'cmd' as a line in your startstop_nt.d with a NewConsolEarthworm Windows Service 
     66 
     67(last revised 11 September, 2009)[[BR]] 
     68Readme for startstop_service[[BR]] 
     69---------------------------- 
     70 
     71Service functionality added by:[[BR]] 
     72Mark Morrison[[BR]] 
     73USGS - Golden, CO[[BR]] 
     74 
     75(Some additional edits or comments in these docs by Stefan Lisowski) 
     76 
     77Setup of startstop_service (Follow these instructions carefully.)[[BR]] 
     78-------------------------- 
     79 
     80startstop_service is identical to the old startstop_nt, except that it runs as a Windows service. This means that the parameters are all the same - read from startstop_nt.d - but that startstop isn't just executed from a command window or via the scheduler. Note that this version is taken from startstop_nt, so I haven't compiled or tested any of this under Solaris or other systems. I believe it's generally felt, however, that these modifications don't apply to Solaris. 
     81 
     82To install startstop_service as a service, do the following: 
     83 
     84- Open a command window. Switch to the directory containing the startstop executable (if it's not already in the Windows path). 
     85 
     86- Type: startstop_service -install[[BR]] 
     87This will install the service. You should get a message saying that installation was successful. 
     88 
     89- Open the Services Control Panel. (It's under Control Panel->Administrative Tools->Services.) You should see something listed as "Earthworm start-stop". Verify that this service is set to run in Automatic mode (meaning it automatically starts after a reboot, without waiting for user intervention.) 
     90 
     91- By default, startstop is set to run as the "Local Service" account. We need to change this to run as the Administrator, or else any Earthworm rings won't be accessible to other users, and typing "status" won't work. To change the user the service runs under, Select the Properties of the startstop service (double-clicking or selecting Properties from the toolbar). Select the Log On tab, select This account, and select Browse. For Win2000 machines, select the Administrator account from the list, then click OK. Type in the password twice, and click OK again. For WinXP machines, select Advanced, then click Find Now. The listbox at the bottom should show all the users locally set up on that computer. Select the Administrator, then click OK twice. Now type in the Administrator password twice, then click OK again. 
     92 
     93NOTE: This whole rigamarole means that whenever the Administrator password is changed on a machine running startstop, the password must be changed again from the Services control panel. 
     94 
     95- There's no way I've been able to find that allows environment variables to be loaded via ew_nt.cmd (or a similar file) before startstop runs. So, any environment variables required for Earthworm functionality have to be loaded systemwide before starting the startstop service. To set environment variables, select the System control panel, select the Advanced tab, and select Environment Variables. Under the "System variables" window (NOT the "user variables for XXX User" window), make sure that any environment variables you'll need are defined here. A typical subset may include:[[BR]] 
     96- EW_HOME[[BR]] 
     97- EW_INSTALLATION[[BR]] 
     98- EW_LOG[[BR]] 
     99- EW_PARAMS[[BR]] 
     100- SYS_NAME[[BR]] 
     101- TZ[[BR]] 
     102In addition, make sure \earthworm\bin directory (or whichever directory contains your earthworm binaries) is included somewhere in the "Path" variable. Once these are set, click OK, and reboot the machine. 
     103 
     104(Note that setting the Timezone Here to UTC may affect how other non-earthworm applications on your machine keep track of and display time.) 
     105 
     106- If you didn't have to change any environment variables and reboot, you can now start the startstop service by clicking Start from the Services Control Panel (the triangle "Play" button). If you reboot, the service will start automatically. 
     107 
     108Notes on running startstop_service[[BR]] 
     109---------------------------------- 
     110 
     111Apart from running as a Windows service, startstop_service behaves just as startstop_nt. One interesting note is that if you select startstop_service in the Services control panel and click Stop or Restart, then startstop will attempt to shut down all applications attached to its ring via an Earthworm TERMINATE message. 
     112 
     113If you want to look at the Status of Earthworm, or if you want to Restart an Earthworm module or Reconfigure Earthworm's modules and rings, and you aren't logged in as Administrator, you can either use StartstopConsole, or you can do the following if you know the Administrator password: (Instructions for Windows XP, but may work on other versions of Windows. See below for Vista.):[[BR]] 
     114- Go to the Windows Start menu, and choose "Run"[[BR]] 
     115- Type the following: 
     116 
     117{{{ 
     118runas /user:YOUR_MACHINE_NAME_HERE\administrator cmd 
     119}}} 
     120 
     121- This will open up a command window which should be able to connect to the running Earthworm, and thus allow you to type "restart", "reconfigure", "status", "pidpau" or "pau" here. 
     122 
     123- To view what's going on in Vista or Windows Server 2008 
     124 
     125StartstopConsole won't work in Vista, nor will "runas" give you access to the session zero.[[BR]] 
     126- Beforehand, add 'cmd' as a line in your startstop_nt.d with a NewConsole, and reboot so the service starts this up.[[BR]] 
     127- if you're not at the machine, make a remote desktop connection as whatever user you like[[BR]] 
     128- open a command prompt[[BR]] 
     129- if you're not running as administrator, in the command prompt type:[[BR]] 
     130{{{ 
     131runas /user:YOUR_MACHINE_NAME_HERE\administrator cmd 
     132}}} 
     133enter the admin password[[BR]] 
     134- in the new administrator command prompt that comes up type: 
     135{{{ 
     136sc config ui0detect start= auto 
     137sc start ui0detect 
     138}}} 
     139(if you get a Interactive Services Detection dialog, you can choose "Ask me later) 
     140 
     141Once you've done all of the above, you can access session zero. The machine could be rebooted, different users couldlog in, etc. For any user to access startstop_service's session zero: 
     142 
     143- in a command prompt window now you can type: 
     144{{{ 
     145rundll32 winsta.dll,WinStationSwitchToServicesSession 
     146}}} 
     147 
     148This will switch you to console 0. If you added a cmd prompt to startstop_nt.d, you should see it here now, and can type "status" or whatever. 
     149 
     150That's a bit of a handful to type. Since your earthworm bin directory is already in your Windows path, you can cd to that bin directory and do something like: 
     151{{{ 
     152echo rundll32 winsta.dll,WinStationSwitchToServicesSession > session0.bat 
     153}}} 
     154So now you can just type "session0" at a command prompt to get to the startstop session. 
     155 
     156Note that this means that ANY user of the system will be able to get a prompt with administrator privileges. I this essentially the same power one has with startstopconsole which has been part of Earthworm for a while. 
     157 
     158(This was all tested with Vista. It _should_ work with Windows Server 2008 too, but hasn't been tested there yet. If you do it successfully or unsuccessfully please let us know.) 
     159 
     160With 2003 Server 
     161 
     162How to Connect to the Console Session 
     163 
     164(From http://support.microsoft.com/kb/278845) 
     165 
     166When you connect to the console session of a Windows Server 2003-based server, no other user has to be already logged on to the console session. Even if no one is logged on to the console, you are logged on just as if you were sitting at the physical console. 
     167 
     168To connect from the remote Windows Server 2003-based computer, open a command prompt, and then type the following command: 
     169{{{ 
     170mstsc -v:servername /F -console 
     171}}} 
     172where mstsc is the Remote Desktop connection executable file, -v indicates a server to connect to, /F indicates full screen mode, and -console is the instruction to connect to the console session. 
     173 
     174Removing startstop_service[[BR]] 
     175---------------------------------- 
     176 
     177If you ever need to remove startstop_service from your machine, first stop the service (as above), then open a command window and type: startstop_service -uninstall[[BR]] 
     178You should also perform this step if you ever need to move the startstop binary to another directory on your hard drive; otherwise, Windows will not know where to find the executable.[[BR]] 
     179Questions? Issues? Subscribe to the Earthworm Google Groups List.e, and reboot so the service starts this up.[[BR]] 
     180- if you're not at the machine, make a remote desktop connection as whatever user you like[[BR]] 
     181- open a command prompt[[BR]] 
     182- if you're not running as administrator, in the command prompt type: 
     183{{{ 
     184runas /user:YOUR_MACHINE_NAME_HERE\administrator cmd 
     185}}} 
     186enter the admin password[[BR]] 
     187- in the new administrator command prompt that comes up type: 
     188{{{ 
     189sc config ui0detect start= auto 
     190sc start ui0detect 
     191}}} 
     192(if you get a Interactive Services Detection dialog, you can choose "Ask me later) 
     193 
     194Once you've done all of the above, you can access session zero. The machine could be rebooted, different users couldlog in, etc. For any user to access startstop_service's session zero: 
     195 
     196- in a command prompt window now you can type: 
     197{{{ 
     198rundll32 winsta.dll,WinStationSwitchToServicesSession 
     199}}} 
     200This will switch you to console 0. If you added a cmd prompt to startstop_nt.d, you should see it here now, and can type "status" or whatever. 
     201 
     202That's a bit of a handful to type. Since your earthworm bin directory is already in your Windows path, you can cd to that bin directory and do something like: 
     203{{{ 
     204echo rundll32 winsta.dll,WinStationSwitchToServicesSession > session0.bat 
     205}}} 
     206So now you can just type "session0" at a command prompt to get to the startstop session. 
     207 
     208Note that this means that ANY user of the system will be able to get a prompt with administrator privileges. I this essentially the same power one has with startstopconsole which has been part of Earthworm for a while. 
     209 
     210(This was all tested with Vista. It _should_ work with Windows Server 2008 too, but hasn't been tested there yet. If you do it successfully or unsuccessfully please let us know.) 
     211 
     212With 2003 Server 
     213 
     214How to Connect to the Console Session 
     215 
     216(From http://support.microsoft.com/kb/278845) 
     217 
     218When you connect to the console session of a Windows Server 2003-based server, no other user has to be already logged on to the console session. Even if no one is logged on to the console, you are logged on just as if you were sitting at the physical console. 
     219 
     220To connect from the remote Windows Server 2003-based computer, open a command prompt, and then type the following command: 
     221{{{ 
     222mstsc -v:servername /F -console 
     223}}} 
     224where mstsc is the Remote Desktop connection executable file, -v indicates a server to connect to, /F indicates full screen mode, and -console is the instruction to connect to the console session. 
     225 
     226Removing startstop_service[[BR]] 
     227---------------------------------- 
     228 
     229If you ever need to remove startstop_service from your machine, first stop the service (as above), then open a command window and type: startstop_service -uninstall[[BR]] 
     230You should also perform this step if you ever need to move the startstop binary to another directory on your hard drive; otherwise, Windows will not know where to find the executable.[[BR]]