In temux 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! [email protected] kill: `kill $(lsof -t -i:8083)`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] 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'"
[email protected] 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
Use the command
sudo netstat -plten |grep java
used grep java
as tomcat
uses java
as their processes.
It will show the list of processes with port number and process id
tcp6 0 0 :::8080 :::* LISTEN
1000 30070621 16085/java
the number before /java
is a process id. Now use kill
command to kill the process
kill -9 16085
-9
implies the process will be killed forcefully.