Spooler Service on Windows 2000
The jBASE spooler (SPOOL) can optionally be set up to run on Windows 2000 as a service instead of as a background job. It works by waking up at a user-defined interval and executing the REST-SPOOLER command and capturing the output. Note that if a spool queue dies (KILLED status), you should wait for this program to restart it and not do a RESUME printing or you will create a despool process which is merely a background job for the current user, which will die when the user logs off.
You will not be able to start the jBASE spooler service unless you have the executables SRVANY.EXE and INSTSRV.EXE, which are part of the Windows 2000 Resource Kit from Microsoft. Ensure that you have these two programs on your PC before proceeding further.
Set Up jBASE Spooler as a User
1) Create Home Directory and User
Log on with administrator privileges and decide where the jBASE spooler's home directory will reside, and create it using Windows Explorer, if it doesn't already exist. Also create a subdirectory for it called "bin". In this document, we will use the local path of C:\USERS\jBASESpooler as the HOME directory. If you are using a different path, be sure to substitute your path for the one we are using in this document. Although the SP-NEWTAB command (which you will execute later in these instructions) does create a directory called "jspooler" under C:\JBASE30, it is not advisable to use this as the HOME directory.
Next, create a user called jBASESpooler and assign it a password (Control Panel -> Administrative Tools -> Computer Management -> System Tools -> Local Users and Groups -> Users -> Action -> New User). In the New User form, uncheck the "User must change password at next logon" option, and check the options "User cannot change password" and "Password never expires." Click the "Create" button and then click the "Close" button. Next, select the new user, pull down the "Action" menu, and select "Properties." Select the "Member Of" tab, click on the "Add" button, and choose the group "Administrators". The user jBASESpooler should be a member of both "Users" and "Administrators."
2) Install the Source
COPY the source program, Spool.b, into the HOME directory of the jBASESpooler user. Log off.
3) Set Up Environment
Log on as jBASESpooler. If you notice that any applications start up automatically, disable them so that they do not start up in future logons. Right-click on the "My Computer" icon on the desktop, choose "Properties," click on the "Advanced" tab, and then click the "Environment Variables" button. Create a HOME variable with the value being the path to the home directory of jBASESpooler. Create another variable called "PATH", if it doesn't already exist, and ensure that the "bin" directory under jBASESpooler's HOME directory is included. Create another variable called JEDIFILEPATH, and assign it the same value of your HOME directory, appended with a semicolon and "C:\JBASE30\jspooler", followed by another semicolon plus "C:\JBASE30\jspooler\jobs". Note that jBASE only detects environment variables at the time of logon, so you must now log off and log on as jBASESpooler again.
4) Check Default Printer
Next check that you have a default printer defined. Go into Control Panel -> Printers. If there is not at least one printer shown, you must execute the "Add Printer" and set up a printer and assign it as your default printer.
5) Compile and Catalog Spool Program
Start up a jShell session. Before compiling and cataloging "Spool.b", check the loop delay at the end to see how often you would like the program to wake up and check that the despool processes are running. The default interval is 600 seconds (10 minutes). When you've confirmed that the wake-up interval is adequate for your needs, either FIBC from JED or enter jbc Spool.b -Jo %HOME%\bin\Spool.exe at the jShell prompt. Log off.
Set Up the Service
6) Install the Service
Log on as an administrative user. Copy the program C:\Program Files\Resource Kit\SRVANY.EXE to a convenient place on your system that is included in your PATH. A reasonable choice is D:\JBASE30\BIN. Note that you may place the SRVANY.EXE program anywhere you want, but you should not move it once you have installed the service. Now install an instance of the SRVANY service using the INSTSRV.EXE program provided with Windows 2000 Resource Kit, by clicking Start -> Run -> and entering
INSTSRV jBASESpooler D:\JBASE30\BIN\SRVANY.EXE
7) Create Registry Entries
Go into the Registry Editor (Start -> Run -> regedit ) and open HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\jBASESpooler. If there is not already a key called "Parameters" under this directory, you need to create one (Edit -> New -> Key). Then click on the "Parameters" and look at its contents. If String Values of "Application" and "AppParameters" are not listed, you will need to create them by choosing Edit -> New -> String Value. Once they are created, select each one choose Edit -> Modify, and enter the following in the "Values Data" input box, respectively:
AppParameters: -Jb -c "C:\USERS\jBASESpooler\bin\Spool.exe"
8) Set Service Parameters
Now start up the Control Panel -> Administrative Tools -> Computer Management -> Services and Applications -> Services applet. Locate "jBASESpooler" in the list of services shown and double click on it. Under the "General" tab, there is a drop-down menu field labeled "Startup type". Set this to "Automatic" so that the service starts automatically when the system is rebooted. After choosing startup type, click on the "Log On" tab and select the "Local System account" option, leaving the "Allow service to interact with desktop" option unchecked. Next, click on the "General" tab again, and then click the "Start" button. You should see the status change to indicate "Started."
9) Initialize the Spooler
To initialize the jBASE spooler, invoke the jShell and enter the command SP-NEWTAB. If you don't need to change anything, simply enter C to continue, and then exit the jShell.
10) Restart and Verify Service
Keep in mind that services, such as the jBASE spooler, take effect when the PC is powered up, rather than at the time of log on. Therefore, you must restart your PC. When you logon after restarting, go to Control Panel -> Services. You should see "jBASESpooler" listed, and it's status should be "Started." You should also see "Spool.exe" running as a process under the Task Manager.