Task not running in service

Discuss RoboTask here
Post Reply
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Task not running in service

Post by deesloop »

I have several tasks
I write them logged then stop the robotask service and then copy the task from the local profile to the service path and then start the service.
It's always worked that way.

However the task isn't running - or at least I don't believe it ran cos the email isn't being received
I can run the task when logged in and it was fine. sql query runs, file gets updated, file gets emailed

However the service nothing happens.
Certainly the file doesn't get updated and there is no email.
How can that be?

Is it possible a task can run but not run in service mode?

First time thishas happened
Oleg
Site Admin
Posts: 3033
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Task not running in service

Post by Oleg »

Is it possible a task can run but not run in service mode?
Yes, this is possible. System service works in separate environment (SYSTEM session)
It's necessary to analyze your task to say more exactly.
Oleg Yershov
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Re: Task not running in service

Post by deesloop »

OK here's the code

I believe I chnaged the task to run with the correct credentials rather than those of the session.
It works when ran manually logged in with the credentials.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task17"
Hide=INTEGER|0
ID=INTEGER|1909129044
LocalVariables=STRING|"""FIELDS="""""""""",""VALS="""""""""""
LogOnAsUser=INTEGER|1
Name=STRING|"Email VCentre CPU usage"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER

[Actions\Action1]
ActionID=STRING|"A_LOOP_DATASET"
Enabled=INTEGER|-1
Name=STRING|"Dataset Loop"
Params=FOLDER

[Actions\Action1\Params]
commatext=STRING|"0"
connectionstring=STRING|"Provider=MSDASQL.1;Persist Security Info=False;Data Source=VCenter_sql"
override=STRING|"1"
password=STRING|"2748523975293402679423964"
sql=STRING|"""USE ECM"",""DECLARE @ts_now bigint = (SELECT cpu_ticks/(cpu_ticks/ms_ticks)FROM sys.dm_os_sys_info); "",,""SELECT TOP(512) SQLProcessUtilization AS [SQL Server Process CPU Utilization], "",""               SystemIdle AS [System Idle Process], "",""               100 - SystemIdle - SQLProcessUtilization AS [Other Process CPU Utilization],"",""               DATEADD(ms, -1 * (@ts_now - [timestamp]), GETDATE()) AS [Event Time]"",""               "",""FROM ( "",""	  SELECT record.value('(./Record/@id)[1]', 'int') AS record_id, "",""			record.value('(./Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int') "",""			AS [SystemIdle], "",""			record.value('(./Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]', "",""			'int') "",""			AS [SQLProcessUtilization], [timestamp] "",""	  FROM ( "",""			SELECT [timestamp], CONVERT(xml, record) AS [record] "",""			FROM sys.dm_os_ring_buffers "",""			WHERE ring_buffer_type = N'RING_BUFFER_SCHEDULER_MONITOR' "",""			AND record LIKE '%<SystemHealth>%') AS x "",""	  ) AS y "",""ORDER BY record_id DESC;"""
timeout=STRING|"60"
userid=STRING|"rjmcleod\administrator"
var1=STRING|"FIELDS"
var2=STRING|"VALS"
withmemo=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file C:\sqlcpu.txt"
Params=FOLDER

[Actions\Action2\Params]
encode=STRING|"0"
fileexists=STRING|"1"
filname=STRING|"C:\sqlcpu.txt"
line0=STRING|"{VALS}"
linecount=STRING|"1"
suppress=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action4]
ActionID=STRING|"A_INET_SENDMAIL"
Enabled=INTEGER|-1
Name=STRING|"Send Email"
Params=FOLDER

[Actions\Action4\Params]
attach0=STRING|"C:\sqlcpu.txt"
attachcount=STRING|"1"
auth=STRING|"0"
charset=STRING|"iso-8859-1"
from=STRING|"robotask@rjmcleod.co.uk"
host=STRING|"dingmail"
html=STRING|"0"
msg0=STRING|"{VALS}"
msgcount=STRING|"1"
password=STRING|"2488925194251982698924937"
passwordmode=STRING|"0"
port=STRING|"25"
SSL=STRING|"0"
subject=STRING|"SQL performance for last 4 hours"
to=STRING|"dslupek@rjmcleod.co.uk"

[Events]
Event1=FOLDER

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

[Events\Event1\Params]
id=STRING|"3Z3LJ0OD"
periodicity=STRING|"0"
startdate=STRING|"42026"
time0=STRING|"10808000"
time1=STRING|"25208000"
time2=STRING|"39608000"
time3=STRING|"54008000"
time4=STRING|"68408000"
time5=STRING|"82808000"
timecount=STRING|"6"
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Re: Task not running in service

Post by deesloop »

Even if the SQL failed, I'd still expect an email to come through
Oleg
Site Admin
Posts: 3033
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Task not running in service

Post by Oleg »

The task looks correct.
You can test it manually in service mode and see what happened.
Read here how to access RoboTask service via "Interactive Service Detection" service: http://www.robotask.com/help/index.php? ... ervice.htm
I don't see another ways.

Also see what message task writes into its log file.

BTW: I think that this is bad idea to save temporary file in the root of system disk.
Oleg Yershov
deesloop
Posts: 70
Joined: Wed Feb 25, 2009 3:44 am

Re: Task not running in service

Post by deesloop »

OK I followed the instruction and nothing happens..
According to your instructions

- You will see this message. Press "View the message"

That doesnt happen

However using the 2nd method I could connect and see lots of errors.
An error occurred. Step #1 (Dataset Loop).

Out of interest, is using the network version a suitable way of editing task directly
I normally edit them in the console and copy them to the c:\program files\robotask\tasks folder
But this way is much quicker.
I'm assuming that a service restart would be needed for adding new task this way
But does the same apply to editing the task in this way?

If I leave the session open in the console it runs fine
Just not the service version.
Oleg
Site Admin
Posts: 3033
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Task not running in service

Post by Oleg »

That doesnt happen
You have to turn On "Allow service to interact with desktop" parameter if you want to see service in SYSTEM session. Of course you have to use SYSTEM account.
See screenshot below:
serviceconfig.png
serviceconfig.png (70.78 KiB) Viewed 28573 times
However using the 2nd method I could connect and see lots of errors.
An error occurred. Step #1 (Dataset Loop).
It seems database client of MSSQL have some problems in service mode. This requires additional investigation. I'm afraid that I can't assist you.
Oleg Yershov
Post Reply