Howto:IQM server as a service: Difference between revisions

From innovaphone wiki
Jump to navigation Jump to search
No edit summary
Line 37: Line 37:




===Installing Drivers===
===Configuring IQM Server as service===


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.  
'''Before continue: IQM server has to be already configured and tested.'''


Therefore check where your path environment value is pointing. How to check this depends on your OS:
On Windows, Right click on the start button and select "Control Panel"


Windows 8:
On top left, change the view from "Category" to "Small icons"


• Drag the Mouse pointer to the Right bottom corner of the screen
Open "Administrative Tools" and double click on "Task Scheduler"


• Click on the Search icon and type: Control Panel (in German “Systemsteuerung”)
On the Tab "Actions" on the left, click on "Create Task" and a new window will open.


• Click on -> Control Panel -> System -> Advanced (in German “System/Erweitere Systemeinstellungen”)
Give a task name like "IQM Server", a description if desired, choose the account that should run the program and choose "Run whether user is logged on or not"


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


Windows 7:
[[Image:IQMServicecreatetask.PNG]]


• 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.
Select the next tab "Triggers", click "New" a new windows will appear.  


On the "Begin the task" select "At startup" and check that on the bottom the "Enabled" is flagged, then click "ok".


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\”.
[[Image:IQMServicenew trigger.PNG]]


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”.


Select the next tab "Actions", on the bottom left click "New"


Download now the actual version of “srvstart.exe”, you can find it for example in this external site:
A new window appear, on the Action tab select "Start a program" , then click on "browse" and choose the IQM.exe file that usually is located in " C:\Program Files (x86)\innovaphone\QueueMonitor\iQM " , check that the correct path is written in the "Program/script" tab and then click "ok"


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.
[[Image:IQMServiceActions.PNG]]


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).
Select next tab "Conditions" and unflag the option "Start task only if the computer is on AC power"


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”
[[Image:IQMServiceconditions.PNG]]


===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\”.
Select the next tab "Settings"


Open a Text Editor and write this Text:
Put the flag on "If the task fails, restart every:" and leave "1 minute" and "Attempt to restart up to:"  "3 times"


  [iQM_SERVICE]
Remove the flag from "Stop the task if it runs longer than:" and press "OK"
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\”.
[[Image:IQMServiceSettings.PNG]]
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”).
A popup will display, asking you to insert the password of a user with the rights to create tasks (usually the administrator) and press "OK"


Write
Now, on the tasks list, the new IQM Server task should be displayed.


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


Observing the case (use for example “ –c” and not “-C”).
[[Image:IQMServicecheck.PNG]]


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
To test this, just restart the PC, and after the login check that in the task manager the IQM service is running.


net start iQM_SERVICE


Start now the Agent, you will see that the server is on and operating.  
[[Image:IQMServicetask manager.PNG]]


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===
===Change IQM configuration===


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:
After starting the IQM as service, you will notice that you won't be able to open it's main screen while is running. If you try to open it, it will open another IQM server instance. Said that, to modify the IQM server setting, stop the IQM Server as described in the next chapter.


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”.
[[Image: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===
===Control and  Stop the iQM service===
Line 149: Line 122:


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.
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.
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.

Revision as of 16:12, 9 August 2018

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.


Configuring IQM Server as service

Before continue: IQM server has to be already configured and tested.

On Windows, Right click on the start button and select "Control Panel"

On top left, change the view from "Category" to "Small icons"

Open "Administrative Tools" and double click on "Task Scheduler"

On the Tab "Actions" on the left, click on "Create Task" and a new window will open.

Give a task name like "IQM Server", a description if desired, choose the account that should run the program and choose "Run whether user is logged on or not"


IQMServicecreatetask.PNG



Select the next tab "Triggers", click "New" a new windows will appear.

On the "Begin the task" select "At startup" and check that on the bottom the "Enabled" is flagged, then click "ok".


IQMServicenew trigger.PNG


Select the next tab "Actions", on the bottom left click "New"

A new window appear, on the Action tab select "Start a program" , then click on "browse" and choose the IQM.exe file that usually is located in " C:\Program Files (x86)\innovaphone\QueueMonitor\iQM " , check that the correct path is written in the "Program/script" tab and then click "ok"


IQMServiceActions.PNG


Select next tab "Conditions" and unflag the option "Start task only if the computer is on AC power"


IQMServiceconditions.PNG


Select the next tab "Settings"

Put the flag on "If the task fails, restart every:" and leave "1 minute" and "Attempt to restart up to:" "3 times"

Remove the flag from "Stop the task if it runs longer than:" and press "OK"


IQMServiceSettings.PNG


A popup will display, asking you to insert the password of a user with the rights to create tasks (usually the administrator) and press "OK"

Now, on the tasks list, the new IQM Server task should be displayed.


IQMServicecheck.PNG


To test this, just restart the PC, and after the login check that in the task manager the IQM service is running.


IQMServicetask manager.PNG


Change IQM configuration

After starting the IQM as service, you will notice that you won't be able to open it's main screen while is running. If you try to open it, it will open another IQM server instance. Said that, to modify the IQM server setting, stop the IQM Server as described in the next chapter.


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.

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