Behaviour observed in 10.2.600 and 10.2.700. When you have a Scheduled Item set for Startup if you restart your Task Agent, it won’t fire. If you stop and start your Task Agent within 1 minute, the same it won’t fire. You have to either way 1+ minutes before you start it again, or you blank out the NextRunOnDate… oddly enough Epicor sets it and sets it back to null after a successful 1+ min wait and Start of TA Service.
@JeffLeBert is this a built in timer that is meant to help truly identify restart vs startup? Basically Startup Schedules only fire if there is a 60 second wait between the Stop/Start.
I’ve had internal people ask me this question. We’ve even written it up as a something to do in our work tracking software. This has always been a low priority since it kind of makes sense to work that way. I’ve never gotten time to investigate it.
My guess is that it comes from the code we added to allow multiple Task Agent Services to run. You don’t want Service B picking up the tasks that Service A is already processing. That’s a total guess though.
If you ever see it do this but the time delay is 2+ minutes, then I would raise the priority of the investigation.
@JeffLeBert I wasn’t much upset over the 1 minute, now that I know figured out I communicate my observation for those that have “fast servers”
Here is what happened:
Restart TA
Why isn’t Multi-Company Starting Up Again?
Repeat 1-2, 5 times.
Stop TA (not a restart, but a stop)
Start TA
Why isn’t Multi-Company Starting Up Still?!
Blank out the Next Run Date
Refresh System Agent Entry, Epicor put in a Next Run again.
Enable/Disable Schedule, Still Nothing… Rebuild entire Multi-Company Schedule and spend 30min troubleshooting and checking my data
Stop TA
Blank out Next Run Date
Start TA - ok it started Multi-Company a StartUp task this time!
Stop TA
Start TA
Repeat 13-14 a few times.
Stop TA
Wait about 1-2min
Start TA - It Started fine and Epicor blanked out the NextRun for StartUp yay again!
I was looking in the docs to find a “please wait 60 seconds after you stop TA, before you start it again” I can replicate it everytime. Stopping takes 15 seconds, Starting takes 15 seconds, hence the problem… it works too fast for its own good
It may be something as simple as an if/else in ScheduledTaskRunner.cs
@hkeric.wci I’m glad you did all the hard work for me I moved my CDC stuff for Collab to ‘startup’ and it’s been aggravating me ever since, Glad I found this - Thank you!
So I wrote these two and have them scheduled for one a week using Windows Task Scheduler - note the 90 second delay.
DOS CMD (Powershell is below)
REM Stop Task Agent
@echo off
cd C:\Program Files (x86)\Epicor Software\Epicor Task Agent Service 4.1.100.0
REM echo Stopping Task Agents
TaskAgentServiceConfiguration.exe -action="stopagent" -agentname="MyTaskAgent"
TaskAgentServiceConfiguration.exe -action="stopagent" -agentname="MyTestTaskAgent"
REM Echo Pausing...
timeout /t 10 /nobreak
REM Echo Stopping Service
net stop EpicorICETaskAgent4.1.100.0
REM Echo Pausing...
timeout /t 10 /nobreak
REM Echo Starting Service
net start EpicorICETaskAgent4.1.100.0
REM Echo Pausing...
timeout /t 90 /nobreak
REM Echo Starting Agents
TaskAgentServiceConfiguration.exe -action="startagent" -agentname="MyTaskAgent"
TaskAgentServiceConfiguration.exe -action="startagent" -agentname="MyTestTaskAgent"
cd C:\Users\<administrator>\Desktop
Powershell
#Set-ExecutionPolicy -ExecutionPolicy Unrestricted
#### Attempt to Stop AshworthTestTaskAgent
Start-Process -FilePath "C:\Program Files (x86)\Epicor Software\Epicor Task Agent Service 4.1.100.0\TaskAgentServiceConfiguration.exe" -ArgumentList "-action=`"stopagent`"","-agentname=`"MyTestTaskAgent`"" -RedirectStandardError "c:\EpicortestData\TaskAgentRestart_err.txt" -RedirectStandardOutput "c:\EpicortestData\TaskAgentRestart.txt"
#### Attempt to Stop AshworthTestTaskAgent
Start-Process -FilePath "C:\Program Files (x86)\Epicor Software\Epicor Task Agent Service 4.1.100.0\TaskAgentServiceConfiguration.exe" -ArgumentList "-action=`"stopagent`"","-agentname=`"MyTaskAgent`"" -RedirectStandardOutput "c:\EpicorData\TaskAgentRestart.txt" -RedirectStandardError "c:\EpicorData\TaskAgentRestart_err.txt"
#### Attempt to Recycle the Agent Service
Stop-Service EpicorICETaskAgent4.1.100.0
Start-Sleep -s 10
Start-Service EpicorICETaskAgent4.1.100.0
Start-Sleep -s 90
#### Attempt to Start AshworthTestTaskAgent
Start-Process -FilePath "C:\Program Files (x86)\Epicor Software\Epicor Task Agent Service 4.1.100.0\TaskAgentServiceConfiguration.exe" -ArgumentList "-action=`"startagent`"","-agentname=`"MyTaskAgent`"" -RedirectStandardOutput "c:\EpicortestData\TaskAgentRestart.txt" -RedirectStandardError "c:\EpicortestData\TaskAgentRestart_err.txt"
#### Attempt to Start AshworthTaskAgent
Start-Process -FilePath "C:\Program Files (x86)\Epicor Software\Epicor Task Agent Service 4.1.100.0\TaskAgentServiceConfiguration.exe" -ArgumentList "-action=`"startagent`"","-agentname=`"MyTaskAgent`"" -RedirectStandardOutput "c:\EpicorData\TaskAgentRestart.txt" -RedirectStandardError "c:\EpicorData\TaskAgentRestart_err.txt"