OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Starting ospi.py automatically › Re: Re: Starting ospi.py automatically
Andrew
As a related side note on this, if you want to know what is using what ports run
sudo netstat -anp --ip
You are mainly going to be interested in the listening TCP sockets so if you wish to ignore the rest:
sudo netstat -anp --ip | grep LISTEN
E.g. this example shows a Raspberry Pi running only ospi (python) and sshd for remote connections:
tcp 0 0 192.168.26.15:80 0.0.0.0:* LISTEN 7324/python
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2279/sshd
The first set of addresses will tell you the IP and port (like 192.168.26.15:80 or 0.0.0.0:22 above), then second should always be 0.0.0.0:* because listening sockets are not connected to anything yet, and the end part tells you the process ID and process name of what is listening on that port (python running ospi.py is listening on port 80 above).
A busier server could have a lot more things running on it like this (notice apache on port 80 at the end):
tcp 0 0 0.0.0.0:34355 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 772/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 19913/master
tcp 0 0 0.0.0.0:41119 0.0.0.0:* LISTEN 655/rpc.statd
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 1674/perdition.imap
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 9831/nrpe
tcp 0 0 0.0.0.0:5667 0.0.0.0:* LISTEN 1221/nsca
tcp 0 0 0.0.0.0:37 0.0.0.0:* LISTEN 2611/xinetd
tcp 0 0 0.0.0.0:3493 0.0.0.0:* LISTEN 1537/upsd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 32358/mysqld
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 19913/master
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 665/pop3-login
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 941/imap-login
tcp 0 0 0.0.0.0:4559 0.0.0.0:* LISTEN 1113/hfaxd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 605/portmap
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4439/apache2