B4J Question Error in shell Kill linux

Pooya1

Active Member
Licensed User
Hi
I use B4j output in linux vps
I need kill special process in linux
My code is :
B4X:
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
Try
B4X:
she.Initialize("shell","kill",Array As String("-HUP","29349"))
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I need run this command 10 time in second
Maybe have problem?
Can i set 300 timeout to 0 for execute realtime command?
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
Top