windows 2008 task scheduler return code 1, no logging - windows-task-scheduler

trying to run a simple batch file in windows 2008 task scheduler
call cleanup.bat > cleanup.log;
call ant -f ongoing_changes.xml > automation.log
The action is triggered properly and from the History logs (7 information messages) this seems to be puzzling
Task Scheduler successfully completed task "\Run regression" , instance "{edbd26d2-b71b-43d6-960f-29c31e39493c}" , action "C:\Windows\SYSTEM32\cmd.exe" with return code 1.
Unfortunately nothings gets executed (as no logs are created), even if I trigger manually the task, of course the batch file runs fine if executed from OS. If I don't use "call" in the batch file, then "return code 0" is presented, still nothing gets executed.

First I had to convert the task scheduled to be "Windows server 2003, Windows Xp or Windows 200" then I managed to debug this putting a
"call timeout 5"
at the end of the script and figured out that ant environment wasn't properly loaded, thus commands were failing.

Related

FastAPI Utils - repeat_every doesn't work after some time in Cloud Run

I have a repeated task that runs every 15 minutes.
#app.on_event("startup")
#repeat_every(seconds=60 * 15, wait_first=True)
def myFunction(db=SessionLocal()) -> None:
test(db=db, for_test=False)
It works pretty normal at the beginning. But after some time (Like 5-6 hours) It stops working and never repeats task again. When I check logs in Cloud Run, I see this message;
RuntimeError: coroutine ignored GeneratorExit
Also such logs;
2022-09-29 10:04:04.263 EETTask was destroyed but it is pending!
2022-09-29 10:04:04.263 EETtask: <Task pending name='Task-850' coro=<H2Protocol.send_task() running at /usr/local/lib/python3.9/site-packages/hypercorn/protocol/h2.py:148> wait_for=<Future cancelled> cb=[_gather.<locals>._done_callback() at /usr/local/lib/python3.9/asyncio/tasks.py:767]>
I have to deploy a new revision to make repeated tasks work again. I'd like to know what to do in this situation and why this error occurs. It seems like there is no such problem in localhost.
Should I use Google Scheduler instead of FastApi utils' repeated tasks?
The problem was occuring because of my startup script.
I haven't noticed but i was using --reload tag in production. I can't believe this.
After I edited my startup script for production, everything worked fine.

Task Scheduler not starting task event 101

I am getting the 101 error when task scheduler tries to start a task.
This is an AWS Windows 2019 server.
Research seems to indicate that this is usually a user issue.
My task is set to be run by Administrator
I have checked the security policy and it seems fine.
This is the error in task manager
I can successfully run this from the command prompt.
I did try changing the user to a standard user and the results were the same.

New process type not starting executable

I am attempting to add a Bash shell process type to one of my environments. This bash script updates the process tables and then executes whatever is passed into it.
The Operating system and DB type match my system. Type set to "Other." The command line and parameter fields are set.
I have added the type to "Process Types run on this Server" for my server entry with the same priority as all the other, and max occurance = 1 (no other processes are running in this dev env)
I have added a process, API aware, added a component and appended additional parameters "echo test"
"Process Output Type Settings" has web set for "other"
I start the process, it appears in the process monitor as "queued" but never progresses. But if I copy the command line in "Process Request Parameters" and run it manually on the app server, it works and shows success in the process monitor. However it doesn't post the Log/Trace. Additionally there is no change if I try to make the process not Api aware. As I understand it should at least change to successful after it starts the command line process.
Why would the actual command line process not start? What causes the process to post a Log/Trace? How can I debug this? What else can I troubleshoot?

Logging terminal output after running script

I've just executed a script on a server and forgot to enable the logging of the output.
is it possible to record everything since i started the session after the script has finised executing? (baring in mind this script takes several hours to run)

Process starts but does not work

My ASP.NET program executes an external program (that is supposed to print one-page report) using the Process call as follows:
Process.Start( "PrintOrder.exe", nOrderNumber.ToString());
This works on my computer and on one customer's server.
But on another customer server the process PrintOrder.exe starts (I see it in the Task Manager) but never does what it is supposed to do (print). If I run the PrintOrder.exe from the Command Prompt, not from ASP.NET, it works.

Resources