pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported

Open rdczhzq opened this issue 9 months ago • 8 comments

i,pgadmin-hackers.

I am using pgagent(edb_pgagent_pg16.exe) to config job for custom application (.exe) with arguments.

The problem I encountered if I add command parameters as showed below, I got result with "r"

image

but if I run the test.exxe without the parameters, the result is "s".

image

I am wondering if the pgagent batch scripts doesn't support run exe with parameters? How shall I workaroud this problem.

Looking foward to your reply.

rdczhzq avatar Apr 26 '24 03:04 rdczhzq

Can you check the pgAgent logs why it is failing? BTW, r is for running.

adityatoshniwal avatar Apr 26 '24 05:04 adityatoshniwal

Hi,Aditya

Thanks for your mail.

Please let me know where I can find pgAgent logs, thanks.

Yes, I know r stands for running. But actully it didn't.

Best regards, Joe

@.***

From: Aditya Toshniwal Date: 2024-04-26 13:03 To: pgadmin-org/pgadmin4 CC: rdczhzq; Author Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) Can you check the pgAgent logs why it is failing? BTW, r is for running. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

rdczhzq avatar Apr 26 '24 05:04 rdczhzq

@rdczhzq

I've tested pgAgent in DEBUG mode on Windows but could not replicate the reported issue. To validate its functionality, I executed the following test scenario:

Scenario 1: Open a file using Notepad as a job step of pgAgent.

https://github.com/pgadmin-org/pgadmin4/assets/1632882/903b54be-b300-495f-8939-8bdf5f30996a

Scenario 2: Run a Python program to add two numbers and save the output in the file.

https://github.com/pgadmin-org/pgadmin4/assets/1632882/3955c938-b061-479f-ae37-73cce976f390

Can you please try the notepad example?

akshay-joshi avatar May 15 '24 07:05 akshay-joshi

Hi Akshay

I have tested scenario 1: Failed with following log, and i have checked the old log,it's the same observation I got when I reported the titled issue.

For scenario 2: I don't have python installed, I think for time being, we need to sort out why i got null for jslresult and jslduration and jsistatus=r.

Best regards, Joe

The command line is as following:

Best regards, Joe

@.***

From: Akshay Joshi Date: 2024-05-15 15:19 To: pgadmin-org/pgadmin4 CC: rdczhzq; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) @rdczhzq I've tested pgAgent in DEBUG mode on Windows but could not replicate the reported issue. To validate its functionality, I executed the following test scenario: Scenario 1: Open a file using Notepad as a job step of pgAgent. https://github.com/pgadmin-org/pgadmin4/assets/1632882/903b54be-b300-495f-8939-8bdf5f30996a Scenario 2: Run a Python program to add two numbers and save the output in the file. https://github.com/pgadmin-org/pgadmin4/assets/1632882/3955c938-b061-479f-ae37-73cce976f390 Can you please try the notepad example? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 15 '24 07:05 rdczhzq

More information.

@.***

From: 周志勤 Date: 2024-05-15 15:50 To: pgadmin-org/pgadmin4; pgadmin-org/pgadmin4 CC: Mention Subject: Re: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) Hi Akshay

I have tested scenario 1: Failed with following log, and i have checked the old log,it's the same observation I got when I reported the titled issue.

For scenario 2: I don't have python installed, I think for time being, we need to sort out why i got null for jslresult and jslduration and jsistatus=r.

Best regards, Joe

The command line is as following:

Best regards, Joe

@.***

From: Akshay Joshi Date: 2024-05-15 15:19 To: pgadmin-org/pgadmin4 CC: rdczhzq; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) @rdczhzq I've tested pgAgent in DEBUG mode on Windows but could not replicate the reported issue. To validate its functionality, I executed the following test scenario: Scenario 1: Open a file using Notepad as a job step of pgAgent. https://github.com/pgadmin-org/pgadmin4/assets/1632882/903b54be-b300-495f-8939-8bdf5f30996a Scenario 2: Run a Python program to add two numbers and save the output in the file. https://github.com/pgadmin-org/pgadmin4/assets/1632882/3955c938-b061-479f-ae37-73cce976f390 Can you please try the notepad example? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 15 '24 07:05 rdczhzq

As the issue can reproduce here (with more steplog information(null result)), I suggest this issue still needs to be investigated.

if you need more logs, i can do a data collection. If needed, a Lync session can be arranged to show you how the issue reproduce here.

rdczhzq avatar May 16 '24 09:05 rdczhzq

@rdczhzq

Do one thing stop the pgAgent service, get the path of the binary file and run from command line using "DEBUG -l 2 host=xx port=xx dbname=xx" parameters? OR

Setup a zoom session any time between 10am to 6pm IST(GMT + 5:30) tomorrow.

akshay-joshi avatar May 16 '24 10:05 akshay-joshi

@rdczhzq

Could you please verify one more scenario? Run the command 'c:\release\test.exe measurement 4 20' from the command prompt and confirm if the execution has been completed

akshay-joshi avatar May 16 '24 13:05 akshay-joshi

Hi Akshay

I have test the debug mode: please see the error log below, I will set up a zoom session for you to join.

Pleas note the password is valid for postgres.

Best regards, Joe

C:\Users\Administrator>C:\PGSql\program\bin\pgagent.exe DEBUG -l 2 host=localhost port=5432 user=postgres password=123456 dbname=postgres DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #1] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #2] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #3] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #4] DEBUG: Clearing all connections DEBUG: No connections found!

@.***

From: Akshay Joshi Date: 2024-05-16 18:38 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) @rdczhzq Do one thing stop the pgAgent service, get the path of the binary file and run from command line using "DEBUG -l 2 " parameters? OR Setup a zoom session any time between 10am to 6pm IST(GMT + 5:30) tomorrow. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 17 '24 01:05 rdczhzq

Hi Akshay

Due to specific reasons, I am not able to use Zoom from here.

Do you have some alternative for me to use?

Best regards, Joe

@.***

From: 周志勤 Date: 2024-05-17 09:12 To: pgadmin-org/pgadmin4; pgadmin-org/pgadmin4 CC: Mention Subject: Re: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) Hi Akshay

I have test the debug mode: please see the error log below, I will set up a zoom session for you to join.

Pleas note the password is valid for postgres.

Best regards, Joe

C:\Users\Administrator>C:\PGSql\program\bin\pgagent.exe DEBUG -l 2 host=localhost port=5432 user=postgres password=123456 dbname=postgres DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #1] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #2] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #3] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #4] DEBUG: Clearing all connections DEBUG: No connections found!

@.***

From: Akshay Joshi Date: 2024-05-16 18:38 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) @rdczhzq Do one thing stop the pgAgent service, get the path of the binary file and run from command line using "DEBUG -l 2 " parameters? OR Setup a zoom session any time between 10am to 6pm IST(GMT + 5:30) tomorrow. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 17 '24 01:05 rdczhzq

Hi Akshay

I am not able to use Zoom here. Do you have alternatives?

Best regards, Joe

@.***

From: 周志勤 Date: 2024-05-17 09:12 To: pgadmin-org/pgadmin4; pgadmin-org/pgadmin4 CC: Mention Subject: Re: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) Hi Akshay

I have test the debug mode: please see the error log below, I will set up a zoom session for you to join.

Pleas note the password is valid for postgres.

Best regards, Joe

C:\Users\Administrator>C:\PGSql\program\bin\pgagent.exe DEBUG -l 2 host=localhost port=5432 user=postgres password=123456 dbname=postgres DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #1] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #2] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #3] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #4] DEBUG: Clearing all connections DEBUG: No connections found!

@.***

From: Akshay Joshi Date: 2024-05-16 18:38 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) @rdczhzq Do one thing stop the pgAgent service, get the path of the binary file and run from command line using "DEBUG -l 2 " parameters? OR Setup a zoom session any time between 10am to 6pm IST(GMT + 5:30) tomorrow. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 17 '24 01:05 rdczhzq

Hi Akshay

Some background below:

The following conf works with the job with another databse.

However two things I need to point out:

  1. The service was configured running under user admin. When I followed your instruction "run from command line using "DEBUG -l 2 " parameter",it was under user: Administrator,but as you see I supplied with correct username and password there. Will this cause the issue?

  2. Anotherthing I recalled that when I installed the pgagent 2wks ago, I was not able to create the pagent account: postgres as it seems tha tthe password:123456 violates the windows password security policy, that's why I created a user called admin. Wil this cause the issue?

Best regards, Joe

@.***

From: 周志勤 Date: 2024-05-17 09:12 To: pgadmin-org/pgadmin4; pgadmin-org/pgadmin4 CC: Mention Subject: Re: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) Hi Akshay

I have test the debug mode: please see the error log below, I will set up a zoom session for you to join.

Pleas note the password is valid for postgres.

Best regards, Joe

C:\Users\Administrator>C:\PGSql\program\bin\pgagent.exe DEBUG -l 2 host=localhost port=5432 user=postgres password=123456 dbname=postgres DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #1] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #2] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #3] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #4] DEBUG: Clearing all connections DEBUG: No connections found!

@.***

From: Akshay Joshi Date: 2024-05-16 18:38 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) @rdczhzq Do one thing stop the pgAgent service, get the path of the binary file and run from command line using "DEBUG -l 2 " parameters? OR Setup a zoom session any time between 10am to 6pm IST(GMT + 5:30) tomorrow. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 17 '24 02:05 rdczhzq

The account overview on the server runnig pgsql server + pgagent.

@.***

From: 周志勤 Date: 2024-05-17 10:08 To: pgadmin-org/pgadmin4; pgadmin-org/pgadmin4 CC: Mention Subject: Re: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430)

Hi Akshay

Some background below:

The following conf works with the job with another databse.

However two things I need to point out:

  1. The service was configured running under user admin. When I followed your instruction "run from command line using "DEBUG -l 2 " parameter",it was under user: Administrator,but as you see I supplied with correct username and password there. Will this cause the issue?

  2. Anotherthing I recalled that when I installed the pgagent 2wks ago, I was not able to create the pagent account: postgres as it seems tha tthe password:123456 violates the windows password security policy, that's why I created a user called admin. Wil this cause the issue?

Best regards, Joe

@.***

From: 周志勤 Date: 2024-05-17 09:12 To: pgadmin-org/pgadmin4; pgadmin-org/pgadmin4 CC: Mention Subject: Re: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) Hi Akshay

I have test the debug mode: please see the error log below, I will set up a zoom session for you to join.

Pleas note the password is valid for postgres.

Best regards, Joe

C:\Users\Administrator>C:\PGSql\program\bin\pgagent.exe DEBUG -l 2 host=localhost port=5432 user=postgres password=123456 dbname=postgres DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #1] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #2] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #3] DEBUG: Clearing all connections DEBUG: No connections found! DEBUG: Creating primary connection DEBUG: Parsing connection information... DEBUG: Creating DB connection: user=postgres password=***** dbname=postgres host=localhost port=5432 dbname=postgres WARNING: Failed to create primary connection: connection to server at "localhost" (::1), port 5432 failed: "postgres" Password ?? WARNING: Couldn't create the primary connection [Attempt #4] DEBUG: Clearing all connections DEBUG: No connections found!

@.***

From: Akshay Joshi Date: 2024-05-16 18:38 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) @rdczhzq Do one thing stop the pgAgent service, get the path of the binary file and run from command line using "DEBUG -l 2 " parameters? OR Setup a zoom session any time between 10am to 6pm IST(GMT + 5:30) tomorrow. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 17 '24 02:05 rdczhzq

@rdczhzq

Another option could be Google Meet.

akshay-joshi avatar May 17 '24 06:05 akshay-joshi

Google is not accessible either here. :-(

@.***

From: Akshay Joshi Date: 2024-05-17 14:23 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) @rdczhzq Another option could be Google Meet. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 17 '24 06:05 rdczhzq

@rdczhzq

You can set up a meeting where I can join using browser, there is no restriction at our end

akshay-joshi avatar May 17 '24 06:05 akshay-joshi

@.***

From: Akshay Joshi Date: 2024-05-16 21:09 To: pgadmin-org/pgadmin4 CC: Joe; Mention Subject: Re: [pgadmin-org/pgadmin4] pgAgent Job: Issue with windows batch (exe application+ arguments): command arguements not supported (Issue #7430) @rdczhzq Could you please verify one more scenario? Run the command 'c:\release\test.exe measurement 4 20' from the command prompt and confirm if the execution has been completed — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

rdczhzq avatar May 17 '24 07:05 rdczhzq

Put this on hold until the following happens:

  1. A join troubleshooting between Akshay and me is arranged as we google, zoom are not feasible.
  2. A fresh new installation of postgresql is ready for a new test.

rdczhzq avatar May 22 '24 00:05 rdczhzq

Close the issue. When I rewrote the program without reading Console input as following. This feature works.

Console.CancelKeyPress += new ConsoleCancelEventHandler(CancelKeyPressHandler); ConsoleKeyInfo keyInfo = Console.ReadKey(true); if (keyInfo.Key.HasFlag(ConsoleKey.Escape)) { }

image image image

There's one outstanding issue,however I would like to take it seperately.

  1. notepad.exe is not schedulded in the pgagnet job. Is there any configuration to be done so that the windows service can interact with the desktop, I assume the service is not able to interact with desktop by default?

rdczhzq avatar May 23 '24 01:05 rdczhzq