How to count running robotask.exe processes

Discuss RoboTask here
userXXX
Posts: 58
Joined: Wed Jun 11, 2014 8:45 am

How to count running robotask.exe processes

Post by userXXX »

Hi,
we got some trouble after robotask.exe was running parallel in three different processes on one VM. All the scheduled processes run threetimes, filled up database tables with same data etc..
I don't know how we could came into this situation.

How can I set up a task for counting the number of currently running processes of robotask.exe?

OS: Windows 2008 R2 Standard, SP1
Robotask: 6.2.0.859

Thank you.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: How to count running robotask.exe processes

Post by Oleg »

Are all processes running on the same virtual machine? Or you started many RoboTask instances on different VM?
RoboTask can be started only once at a time within the same session.
Oleg Yershov
userXXX
Posts: 58
Joined: Wed Jun 11, 2014 8:45 am

Re: How to count running robotask.exe processes

Post by userXXX »

There were three processes of robotask.exe running in the same session on one VM.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: How to count running robotask.exe processes

Post by Oleg »

How are you doing this??
You can run only ONE instance of RoboTask in the same session.
RoboTask has the program protection against of second copy in the session.
Oleg Yershov
userXXX
Posts: 58
Joined: Wed Jun 11, 2014 8:45 am

Re: How to count running robotask.exe processes

Post by userXXX »

No idea... :(
At the beginning I wrote: "I don't know how we could came into this situation."
Maybe an OS error? Perhaps we should reboot the VM at least once in a month? Maybe one of my colleagues did something wrong... I really don't know.

After recognizing that something is going really wrong (getting lot of confusing error messages and many mails arrived threetimes and so on) I started to find out the reason, but I couldn't. Then I saw three entries of robotask.exe in the task manager and killed them all.

Now I would like to check this by counting the processes every 5 minutes or so, but I don't know how to do this. Any idea?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: How to count running robotask.exe processes

Post by Oleg »

This is possible if you open several remote sessions with same username. I see that you are using Window Server OS
So you opens several identical sessions separately. So RoboTask runs the same set of tasks.

Anyway I can't say more exactly. Your situation require investigation on local computer.
Oleg Yershov
userXXX
Posts: 58
Joined: Wed Jun 11, 2014 8:45 am

Re: How to count running robotask.exe processes

Post by userXXX »

Hi Oleg,

thanks for your ideas. But unfortunately there is only one session possible at the same time with the account we use.

I created a task and two scripts to prevent this kind of problems in case the same situation will occure again (of course I hope it won't 8-) ).

What do you think about that?
Attachments
xxx.rar
(1.37 KiB) Downloaded 2339 times
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: How to count running robotask.exe processes

Post by Oleg »

Infinite LOOP is a very bad idea
See my edition below. I removed the loop and add the Cyclic trigger (every 10 s)

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|2
Events=FOLDER
ExternalName=STRING|"Task405"
Hide=INTEGER|0
ID=INTEGER|1595929141
LocalVariables=STRING|"L_PROCESS=,L_RESULT_LINE=,L_RESULT=,L_SCRIPT_COUNT=,L_SCRIPT_RESTART="
LogOnAsUser=INTEGER|1
Name=STRING|"Check Processes (modified)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|1
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""L_PROCESS"" with value ""robotask.exe"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"1"
varname=STRING|"L_PROCESS"
varvalue=STRING|"robotask.exe"

[Actions\Action10]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 10 sec"
Params=FOLDER

[Actions\Action10\Params]
delay=STRING|"10"
dimension=STRING|"1"

[Actions\Action11]
ActionID=STRING|"A_MISC_RUNCONSOLEAPP"
Enabled=INTEGER|-1
Name=STRING|"Run command-line utility: {L_SCRIPT_RESTART} {L_PROCESS}"
Params=FOLDER

[Actions\Action11\Params]
convertansi=STRING|"0"
ifnonzero=STRING|"0"
params=STRING|"{L_PROCESS}"
program=STRING|"{L_SCRIPT_RESTART}"
saveexitcode=STRING|"0"
saveoutput=STRING|"0"

[Actions\Action12]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action13]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""L_SCRIPT_COUNT"" with value ""{G_SKRIPT_GLOBAL}\count_running_processes.cmd"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"1"
varname=STRING|"L_SCRIPT_COUNT"
varvalue=STRING|"{G_SKRIPT_GLOBAL}\count_running_processes.cmd"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""L_SCRIPT_RESTART"" with value ""{G_SKRIPT_GLOBAL}\restart_vm.cmd"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"1"
varname=STRING|"L_SCRIPT_RESTART"
varvalue=STRING|"{G_SKRIPT_GLOBAL}\restart_vm.cmd"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""L_RESULT_LINE"" with value ""3"""
Params=FOLDER

[Actions\Action4\Params]
expand=STRING|"1"
varname=STRING|"L_RESULT_LINE"
varvalue=STRING|"3"

[Actions\Action5]
ActionID=STRING|"A_MISC_RUNCONSOLEAPP"
Enabled=INTEGER|-1
Name=STRING|"Run command-line utility: {L_SCRIPT_COUNT} {L_PROCESS}"
Params=FOLDER

[Actions\Action5\Params]
convertansi=STRING|"0"
ifnonzero=STRING|"0"
outputvar=STRING|"L_RESULT"
params=STRING|"{L_PROCESS}"
program=STRING|"{L_SCRIPT_COUNT}"
saveexitcode=STRING|"0"
saveoutput=STRING|"1"

[Actions\Action6]
ActionID=STRING|"A_TXT_EXTRACTLINE"
Enabled=INTEGER|-1
Name=STRING|"TXT Extract Line"
Params=FOLDER

[Actions\Action6\Params]
external=STRING|"0"
line00000000=STRING|"{L_RESULT}"
linecount=STRING|"1"
linenum=STRING|"{L_RESULT_LINE}"
variable=STRING|"L_RESULT"

[Actions\Action7]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action7\Params]
case=STRING|"0"
operator=STRING|"8"
type=STRING|"0"
value1=STRING|"{L_RESULT}"

[Actions\Action8]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action8\Params]
case=STRING|"0"
operator=STRING|"3"
type=STRING|"1"
value1=STRING|"{L_RESULT}"
value2=STRING|"1"

[Actions\Action9]
ActionID=STRING|"A_MISC_KILLAPP"
Enabled=INTEGER|-1
Name=STRING|"Terminate process ""{L_PROCESS}"""
Params=FOLDER

[Actions\Action9\Params]
more=STRING|"2"
process=STRING|"{L_PROCESS}"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_CYCLIC"
Params=FOLDER
UnigueID=INTEGER|16445953

[Events\Event1\Params]
interval=STRING|"10"
notsatrtatactivation=STRING|"0"
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Do not forget to enable the task after importing.

Also, check it please, maybe you run RoboTask service with the same set of tasks as RoboTask application.
RoboTask service work in system session and it is hidden for user. Maybe it's enough to stop RoboTask service.

For example I always have 2 instances of RoboTask on my computer:
  • RoboTask application in my user session
  • RoboTask Service in system session
But pay attention, that each instance uses its own set of tasks. Application and service perform different functions at all
Oleg Yershov
userXXX
Posts: 58
Joined: Wed Jun 11, 2014 8:45 am

Re: How to count running robotask.exe processes

Post by userXXX »

Thanks, Oleg.
I changed my loops to this trigger and it works.

No, we don't use RoboTask service.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: How to count running robotask.exe processes

Post by Oleg »

Run the commandline
tasklist /fi "IMAGENAME eq robotask.exe"

I see the text:

Code: Select all

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
RoboTask.exe                  2720 Services                   0    212 880 K
RoboTask.exe                  5916 Console                    1    158 292 K
Two processes in different sessions. It's OK.
Oleg Yershov
Post Reply