PDA

View Full Version : CB as a Service



PCZ
01-11-2004, 09:58 PM
How to run CB as a service in NT. {NT4, Win2K, XP and 2003}

You will need 2 files from the NT resourse kit.
srvany.exe and instsrv.exe.
http://download.microsoft.com/download/8/e/c/8ec3a7d8-05b4-440a-a71e-ca3ee25fe057/rktools.exe

Copy the 2 files to your system32 directory
c:\winnt\system32 or c:\windows\system32
2K uses winnt, XP uses windows as a default.

They could go just about anywhere on your HD but it is better that they are in a directory that is in your path.
Also they don't look out of place there, so the curious won't keep asking what they are.

Install the CB command line client.
On my machines at home I use c:\CB1 CB2 etc
In a corporate enviroment I suggest you use c:\winnt\system32\os2\dll\CB1 CB2 etc.
no one ever looks there !

edit the cbspn.conf file and set the team and handle correctly.
I always use FREE-DC note uppercase spelling.
There has been some debate over this but it always works for me.

On a machine with plenty of ram change the memory usage from the default 16 meg low setting to mid or high.
It is probably best to leave the priority at low unless you are running on a dedicated PC.

NOTE:
There is no need to edit every cbspn.conf file, once you have edited one correctly just copy it over the default cbspn.conf file in any other instances of CB you have installed.
This will avoid the problem of team hopping that can occur if one of your cbspn.conf files is wrong.
I keep a copy of a CB directory on my network and just copy this to any PC's I want to run CB on.

Setting up the service involves a little bit of basic registry editing.
dont let this scare you it really is quite easy.

1: Open a cmd window

2: type: instsrv CB1 c:\winnt\system32\srvany.exe {enter} If you are using 2K
type: instsrv CB1 c:\windows\system32\srvany.exe {enter} If you are using XP

3: If you are going to run multipe instances of CB
Repeat step 2 incrementing the service name by 1 so the second instance would be CB2, the third CB3 etc.

If you get an error about not finding srvany.exe check to make sure srvany.exe is actually in the system32 directory.
Also always type srvany.exe not srvany

NOTE:
if you have upgraded from NT to XP your windows directory is probably still called winnt.

4: Go to start run and type in regedit.

5: Navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

6: In the list of services find CB1 and click on it to highlight it.
Right click on it and select new key
type: Parameters in the box.
If you did this right then there should be a key called Parameters under CB1

7: Right click on Parameters and select new String Value
type: AppDirectory in the box

8: Right click on Parameters again and select new String Value
type: Application in the box

9: Double click on the Appdirectory String value and enter the path to your CB directory in the value data box.
This will be c:\CB1 if you have followed all the steps so far.
Or c:\winnt\system32\os2\dll\cb1 if you are trying to hide it !

10: Double click on the Application String value and enter the path to your CB executable in the value data box.
This will be c:\CB1\cbspn if you have followed all the steps so far.
Or c:\winnt\system32\os2\dll\cb1\cbspn if you are trying to hide it !

11: If you have multiple instances of CB then follow steps 6 to 10 again
for CB2, CB3 etc.

12: You can now go to services and start up CB1, CB2 etc or just reboot they will run automatically.

NOTE:
If you install CB into directories with different names then alter the AppDirectory and Application strings.
Just double click on them and change the value data.

If you want to disable CB but not uninstall it just go to services and either disable or stop the service.

Advantages:

Services start up when the PC starts so there is no need to log in.

It doesn't matter who is logged in as they run as localsystem by default and will continue to run when people log in and out.

You don't need to keep cmd windows open.

Services can easily be started and stopped over a network by remote management.
Computer Management, connect to another computer for example.

They are not totally invisible but most users won't notice them running if the client is well behaved.

instsrv and srvany can be used to run many DC projects as services.
I have used it to run CB, DPAD, DHEP, F@H, D2OL, RSA572, GOT, LifeMapper, FAD and many others.


PCZ

cygnussphere
01-11-2004, 11:50 PM
Nice post:thumbs:
:notworthy :notworthy :notworthy

:tempted:

:evil:

:cheers:

Paratima
01-11-2004, 11:58 PM
Yup, this works! Also, everything PCZ said about NT applies to Windows 2000 (Win2K), as well.

I set the priority to "below_normal", otherwise it can make a big (noticeable) performance dip when it's calculating moves. Especially important on work-boxen! ;)

bwkaz
01-12-2004, 08:15 PM
Is, ahh, it legal to redistribute the Resource Kit?

Paratima
01-12-2004, 10:27 PM
Hmmm. Can't think why not, long as you distribute the whole thing. Not sure even that's necessary. My company is a Micro$oft Partner (whatever THAT means :rolleyes: ). I'll check on it at work tomorrow & see if I can find something definitive.

bwkaz
01-13-2004, 06:35 PM
MS providing a download is not the same as them letting you redistribute (parts of) their software to others...

But I've seen stranger things in their license agreements, is all I was thinking. Stuff like "you agree not to disclose the results of any benchmark test of the .Net Framework Components to any third party without prior written consent of Microsoft Corporation" from the Windows Update one.

There's also a clause in the license that comes with the environment used to develop CE derivatives, where you basically agree to never use any tools that are GPL'ed in connection with your CE-derivative development. Even though the GPL doesn't apply to the work you create with those tools, you still can't use "any tool that purports to give rights to derivative works of itself" (or some such nonsense), because "you can't provide extra rights to the derivative of CE that you create". Even though you won't be doing that, the explanation in the agreement does not invalidate the clause that it explains when the clause itself is written that poorly.

Paratima
01-13-2004, 09:18 PM
Sorry. Had sort of a :swear: day at the ol' office.
Will try again tomorrow when, hopefully, I'll have regained some of my :D .

bwkaz
01-16-2004, 04:57 PM
Originally posted by PCZ
How to run CB as a service in NT. {NT4, Win2K, XP and 2003}

You will need 2 files from the NT resourse kit.
srvany.exe and instsrv.exe.
http://download.microsoft.com/download/8/e/c/8ec3a7d8-05b4-440a-a71e-ca3ee25fe057/rktools.exe This won't install on any OS other than XP (we're trying to use it at work to run a 2K console mode port of a Unix license server as a service). Is there a version on Microsoft's site that will?

Searching download.microsoft.com comes back with nothing...

PCZ
01-17-2004, 06:02 PM
Only the free tools for XP / 2003 contain Instsrv and Srvany.
The free tools for NT4 / 2k do not.

You could install the package on an XP workstation and copy the files to your
2k server.

Probably not legal though :jester:

bwkaz
01-17-2004, 06:28 PM
Originally posted by PCZ
Only the free tools for XP / 2003 contain Instsrv and Srvany.
The free tools for NT4 / 2k do not. Hmm... well, OK then, so much for that idea. Thanks!


You could install the package on an XP workstation and copy the files to your
2k server. We don't have any XP machines (or Server 2k3 either), actually. Never saw the point, since it's basically just NT5.1. Oh well.


Probably not legal though :jester: :spray:

Amazing... ;)

(I wish that cmd.exe didn't wait for all of its children to exit before it exited -- if it didn't, we've got three or four different Unix shell workalikes that we could use to just amp off the process, then exit its controlling shell... it'd work just like a service, but wouldn't require the Resource Kit.)

PCZ
01-18-2004, 12:35 PM
You could have a look in this thread (http://www.free-dc.org/forum/showthread.php?s=&threadid=4965)

You might find what you are looking for there ;)