Howto:IQM server as a service

From innovaphone wiki
Jump to navigation Jump to search

The iQM Server can be started also as a service using a utility.

The advantage starting an iQM server as a service is that no user login is necessary and therefor the service can start automatically when the PC starts up.

Services have no user interface as they run “in background” and they are user independent. All files are stored in absolute directory like “c:\myiQM\” and require therefore admin rights.

From a client point of view there is no difference between having the service or normal executed version s server.


Applies To

This information applies to

iQM server Build 80075 and later.


Installing the iQM server as a service - Walkthroughs

First initial iQM setup

Before starting you should have a clear idea where and how install the iQM and how a iQM server works with the setup directories.

This is also explained in the article “IQM command line arguments”. This article as well as the article “IQM_remote_control” should be read before starting.

When you install an iQM with the innovaphone installer package the iQM server is installed in a directory like this one “c:\Programms (86)\innovaphone\QueueMonitor\iQM”. You can execute the iQM from this position but also copy the iQM.exe in a simpler directory like “c:\myiQM\”; just copy the .exe in that directory. To avoid that a user start the iQM in the original path you can also remove the iQM server using the Windows control panel (Programs and Features).

iQM.exe is a self-containing software that requires no external dll or other files and can be start just clicking on it. Decide where the setup and all other parameters should be stored. In our example we decide to store all that in a sub directory where the .exe is running, so we create a directory in “c:\myiQM\data\”.

Note: If you are already operating a iQM server and want maintain all counters, logs and setup copy the entire content of the actual directory (just follow in the iQM setup the link) in this new directory.

Remember that the iQM must be started from now on with administrator rights (typical) or have in any way the right to access and modify files in the “c:\myiQM\data\” directory.

If you start the iQM server he will try first to find a setup file in your user directory, so open your setup and enter the path “c:\myiQM\data\” and stop the iQM. Starting next time the iQM will search and store the setup data in this directory.

Now run the iQM server normally and do all the setup. Then start some Agent (on the same PC or on a separate one) and test that even there anything works fine as requested.


Installing Drivers

You have to know your application path of your PC. The path is mostly in C:\WINNT\SYSTEM32 in Windows NT, but in all other OS not.

Therefore check where your path environment value is pointing. How to check this depends on your OS:

Windows 8:

• Drag the Mouse pointer to the Right bottom corner of the screen

• Click on the Search icon and type: Control Panel (in German “Systemsteuerung”)

• Click on -> Control Panel -> System -> Advanced (in German “System/Erweitere Systemeinstellungen”)

• Click on Environment Variables (in German “Umgebungsvariablen”), under System Variables (in German “Sytemvariablen”), find PATH, here is the $path of your system.

Windows 7:

• Select Computer from the Start menu

• Choose System Properties from the context menu

• Click Advanced system settings > Advanced tab

• Click on Environment Variables, under System Variables, find PATH, here is the $path of your system.


For all other Systems: if you don´t know .... better give this job to expert people.

A typical application path for a “normal” Win8 PC is “c:\programms (x86)\Windows Live\Shared\”.

Check now if your system has the run-time library “msvcrt.dll”. If this dll is not on your PC download it from MS for your OS System and copy it in the directory of your path. A typical standard Windows Win8 PC has this dll in the directory “c:\windows\system32”.


Download now the actual version of “srvstart.exe”, you can find it for example in this external site:

http://www.nick.rozanski.org.uk/software#srvstart

In this site you will find also all the information stated here, so feel free to follow the original instructions; this Walkthroughs guide you with a typical iQM installation.

Srvstart will not modify the registry (apart from the registry changes due to installing the service itself) and you have to do no Registry operation.

You can use also any other software for start a user defined service, for example “srvany” from MS or NSSM (https://nssm.cc ,tested with Windows 2012r2).

Unpack the zipped file of SRVSTART and copy the files “srvstart.exe”, “srvstart.dll” and “logger.dll” in the directory of your application path.

After doing that in the directory “c:\programms (x86)\Windows Live\Shared\” must be in the files “srvstart.exe”, “srvstart.dll” and “logger.dll”

Writing Batch Files

We need a start-up directory, for example “C:\iQM_Start\”, but it could also be the same directory where the iQM.exe is in, so we use in our example “c:\myiQM\”.

Open a Text Editor and write this Text:

[iQM_SERVICE]
startup=C:\myIQM\iQM.exe -a -b -c iqmpath=c:\myiQM\data\

Save that file in the directory “C:\myiQM\” and call it “SRVSTART.INI”

The “[iQM_SERVICE]” is the service to call while the second line point on the application iQM and at the end you see the iQM setup path “iqmpath=c:\myiQM\data\”. The iQM called as a service will read out this setup parameters from this directory and write logs and counters there. Therefore also in the setup we defined this directory as the working path directory of the iQM. In our example you have to copy the iQM_Setup.xml into the directory c:\myiQM\data\

Installing the service

Now open the cmd window or "Windows PowerShell (x86)" on Windows Server 2012(r2) as an administrator of the system or, if you are logged as a user open is with the administrator rights (Win8, Windows key, type “cmd”, right click on the CMD symbol, select “execute as administrator”).

Write

srvstart.exe install iQM_SERVICE –c C:\myiQM\SRVSTART.INI

Observing the case (use for example “ –c” and not “-C”).

The first time this will require some seconds and this procedure should terminate without error messages.

Now the service is installed and can be started and stopped.

Start the service with the command

net start iQM_SERVICE

Start now the Agent, you will see that the server is on and operating.

Do not use the command “net stop iQM_SERVICE” to terminate the service. If you want to stop the iQM use the stop button on the Agent view, at least install a Agent on the server PC.

Activating Autostart

After the installation the service is in manual mode and will not start automatically when the PC is starting up. To set automatic start-up proceed as following:

Open or start the Task Manager and select the Tab “Services”, order the services by name and search the “iQM_Service”. Select the service and click the right mouse button, select “open services”; the MS Service panel opens. Search and select again “iQM_Service”, right Mouse click, select properties. Here you can define the manual or automatic start-up.

The following picture shows the situation on a German OS, “Dienste” = “Services”.

IQMr04.png


If you want that the service start-up automatically open the control panel (in German “Systemsteuerung”) select Services (in German “Verwaltung) and in Services (in German “Dienste”) you will find the service “iQM_SERVICE”, select and open property, select automatic start. The next time the PC starts up the service will be started automatically.

Control and Stop the iQM service

Once the iQM service is started you can control the status and send commands to the iQM server using a iQM agent. See relative article “remote control”.

Do never terminate the process using the task manager or similar, stop a iQM server always with the exit button on a iQM Agent. Just in this way all counters are saved correctly and the service is shut down in a controlled way. Killing the service with the task manager is for the iQM mostly like switching off the power of the PC.

If you stop the iQM serve as a service using the Exit Key in the iQM Agent the application will be safely stopped as described. Please note that the Process will reamin loadet as service. If terminated i and can be started again with the “net start iQM_SERVICE” command.

So if you have to do complicated changes in the setup or install new features feel free to stop the service using the agent as described. Once stopped just start the iQM in foreground, do all your changes and checks. Once done stop the iQM and start the service again.

Run iQM server setup

If you want modify the setup of the iQM server you have two options: you can stop the service, start the iQM normal and open the setup or you start the iQM server with the “setup” option. This can be done even during operation, but remember that many parameters require a restart and therefore you have to stop and restart the service.

It could be a good idea edit a bat file just for start up the iQM in the Setup mode, remember the necessary administrator rights. See also the iQM command line options article.

Also helpfully is editing a bat file for starting locally the iQM Agent. Remember that even the iQM Agent has to be started as administrator because he wills access to the iQM path. See chapter “Start a bat file with admin right” in the “iQM command line arguments” article.

Please note that running two or more iQM on the same working directory causes unpredictable results. For example one iQM could try to open a file while a second one try to delete this. In any case the “latest” will win because he will overwrite data with “his” own data. So do never run two iQM on the same directory, even if one is working on background as a service. Just in setup mode this can be done in a safe mode.

Related Articles

Howto:IQM_command_line_arguments

Howto:IQM_remote_control

Howto:Queue_Monitor_-_Overview