Lucrez la un sistem Yocto Linux care are un set limitat de instrumente Linux disponibile. Am vrut să opresc procesul care folosea un anumit port (1883).
Mai întâi, pentru a vedea ce porturi ascultăm, am folosit următoarea comandă:
root@root:~# netstat -lt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:hostmon 0.0.0.0:* LISTEN
tcp 0 0 localhost.localdomain:domain 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:9080 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN
tcp 0 0 :::hostmon :::* LISTEN
tcp 0 0 localhost:domain :::* LISTEN
tcp 0 0 :::ssh :::* LISTEN
tcp 0 0 :::1883 :::* LISTEN
Apoi, am găsit numele procesului folosind portul 1883 în felul următor:
root@root:~# fuser 1883/tcp
290
root@root:~# ps | grep 290
290 mosquitt 25508 S /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
12141 root 8444 S grep 290
După cum putem vedea mai sus, programul /usr/sbin/mosquitto
folosește portul 1883.
În cele din urmă, am oprit procesul:
root@root:~# systemctl stop mosquitto
Am folosit systemctl
pentru că în acest caz era un serviciu systemd.
person
Daniel Jonsson
schedule
05.05.2020