Pooya1 Active Member Licensed User Jun 12, 2018 #1 Hi I use B4j output in linux vps I need kill special process in linux My code is : Code: Copy Dim she As Shell she.Initialize("shell","kill -HUP 29349",Null) she.Run(300) StartMessageLoop But i have error for top code org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "kill -HUP 29349" (in directory "."): error=2, No such file or directory) How do i use Linux comment correctly?
Hi I use B4j output in linux vps I need kill special process in linux My code is : Code: Copy Dim she As Shell she.Initialize("shell","kill -HUP 29349",Null) she.Run(300) StartMessageLoop But i have error for top code org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "kill -HUP 29349" (in directory "."): error=2, No such file or directory) How do i use Linux comment correctly?
OliverA Expert Licensed User Longtime User Jun 12, 2018 #2 Try Code: Copy she.Initialize("shell","kill",Array As String("-HUP","29349")) Upvote 0
Pooya1 Active Member Licensed User Jun 13, 2018 #3 OliverA said: Try Code: Copy she.Initialize("shell","kill",Array As String("-HUP","29349")) Click to expand... Yes now working well I need run this command 10 time in second Maybe have problem? Can i set 300 timeout to 0 for execute realtime command? Upvote 0
OliverA said: Try Code: Copy she.Initialize("shell","kill",Array As String("-HUP","29349")) Click to expand... Yes now working well I need run this command 10 time in second Maybe have problem? Can i set 300 timeout to 0 for execute realtime command?
OliverA Expert Licensed User Longtime User Jun 13, 2018 #4 Pooya1 said: I need run this command 10 time in second Maybe have problem? Can i set 300 timeout to 0 for execute realtime command? Click to expand... The timeout command is only used to ensure a program that hangs does not hang up your process (it's a watchdog timer, see https://commons.apache.org/proper/commons-exec/tutorial.html). If you know kill is going to process (not hang), then the timeout value should be -1. As to how fast this run will depend on your system. If you use jShell with Wait For (see https://www.b4x.com/android/forum/threads/b4x-resumable-subs-sleep-wait-for.78601/#post-498109), you can easily launch several jShell's (even before previous ones are complete) and are only limited by system resources. Each jShell call will start a new shell and then processes your command, both of which will require memory and CPU resources. Upvote 0
Pooya1 said: I need run this command 10 time in second Maybe have problem? Can i set 300 timeout to 0 for execute realtime command? Click to expand... The timeout command is only used to ensure a program that hangs does not hang up your process (it's a watchdog timer, see https://commons.apache.org/proper/commons-exec/tutorial.html). If you know kill is going to process (not hang), then the timeout value should be -1. As to how fast this run will depend on your system. If you use jShell with Wait For (see https://www.b4x.com/android/forum/threads/b4x-resumable-subs-sleep-wait-for.78601/#post-498109), you can easily launch several jShell's (even before previous ones are complete) and are only limited by system resources. Each jShell call will start a new shell and then processes your command, both of which will require memory and CPU resources.
Erel B4X founder Staff member Licensed User Longtime User Jun 14, 2018 #5 OliverA said: The timeout command is only used to ensure a program that hangs does not hang up your process Click to expand... Note that a hanging program will not cause your program to hang. A background thread will sit and wait for it to complete. Upvote 0
OliverA said: The timeout command is only used to ensure a program that hangs does not hang up your process Click to expand... Note that a hanging program will not cause your program to hang. A background thread will sit and wait for it to complete.