Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can i kill localhost process ? #5548

Closed
zababurinsv opened this issue Jul 15, 2020 · 1 comment
Closed

Can i kill localhost process ? #5548

zababurinsv opened this issue Jul 15, 2020 · 1 comment

Comments

@zababurinsv
Copy link

zababurinsv commented Jul 15, 2020

In termux i run on port 8083 node.

In ubuntu i use in package.json this script:

but in termux it is not working.

"kill": "kill $(lsof -t -i:8083)"
I get this eror

sh: 1: kill: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! radio@1.0.0 kill: `kill $(lsof -t -i:8083)`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the radio@1.0.0 kill script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.```

npm ERR! A complete log of this run can be found in:
npm ERR!     /data/data/com.termux/files/home/.npm/_logs/2020-07-15T12_44_45_322Z-debug.log

And two variant

"kill": "fuser -k 8083/tcp && echo 'Terminated' || echo 'Nothing thing was running on the PORT'"

radio@1.0.0 kill2 /data/data/com.termux/files/home/server-radio
> fuser -k 8083/tcp && echo 'Terminated' || echo 'Nothing was running on the PORT'
Cannot open protocol file "/proc/net/tcp": Permission denied
Nothing was running on the PORT
@ghost
Copy link

ghost commented Jul 15, 2020

You can kill processes launched within Termux but only if you know their pid or name.

On new Android versions you can't read /proc/net/tcp due to SELinux, so utilities using it will not work without root. Consider using alternate ways of getting pid of processes, e.g. through pidfiles or through matching process name. start-stop-daemon can deal with that.

@ghost ghost closed this as completed Jul 15, 2020
@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant