Win2008 R2 Scheduled Task - Need help

Started by LarryS, February 24, 2015, 01:04:02 PM

Previous topic - Next topic

LarryS

We are looking for some fresh Ideas

We have a new server running  Win 2008 R2
We have a production exe, compiled with WB 2014A. It works  fine when run from a desktop shortcut, but doesn't run as a scheduled task, even though running as Administrator and Win 2008 and Run as highest privileges.
All references to any ââ,¬Å"Mappedââ,¬Â drives have been omitted from code.
All includes, other called apps, and any AddExtender DLLs are located and accessible on the local ââ,¬Å"D:ââ,¬Â drive.
Using DebugTrace, the code seems to freeze when trying to "call" the first UDF.
We can see the last command, but not the call to the function.

--------------------------code snippet--------------------------------------
if !isdefined(uidlistgpg)  (We see this as last entry in the DebugTrace)
    uids=GENERATEUID(inifile,xzipFiles)         (We do not see this in DebugTrace)
-------------------------end---------------------------------------------------

Note: GenerateUID is a function that gets Machine name, and a timestamp.
ie.  ââ,¬Å"AQQ003_2015022310095178ââ,¬Â

one UID per file in the list ââ,¬ËœxzipFilesââ,¬â,,¢ (tab delimited list) and returns such list of UniqueIDs

Adding Debugtrace inside of the Function, revealed nothing.  No log was even started.

td

It is easy enough to test and confirm that calling a UDF from a win2008 R2 scheduled task using WB 2014A does not in and of itself cause a task to 'hang'. So your problem is not occurring simply because you  are calling some random UDF.

It is also easy enough to confirm that a 'DebugTrace' at the top of a UDF for a scheduled task will generate information in a trace file, if at least one line of interpreted code is executed to completion. So there is some chance that  your UDF is failing on the first actually processed line after the DebugTrace function call and the UI error message is just sitting there unviewable.  But possibility depends on the scheduled task's settings.

The most common way to get a scheduled task to 'hang' is to not select the 'Run only when user is logged on' option because you will never see any error messages or other UI elements that the script my display.  So the first thing to is check if your script has proper error handling so it doesn't display any errors or other UI elements, if you have not selected the 'Run only when user is logged on'  option.

You may also want to turn on task history before you run your task.  This may provide useful information. As just an example, while a task may appear to be hung, it may have actually failed to launch or start.  The history log will tell you which is actually the case.

Also keep in mind that the environment for a scheduled task is not the same as the environment for a deck top application so you can't assume that because a resource is available in one environment is necessarily available in the other.   
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

One additional suggestion.  Turn on and check your tasks history  for error 2147943859. The text for this error is 'This operation requires an interactive window station.'
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade