Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
How can i find found following process status. Process is Enabled or disabled using shell script. if its currently running set "1" else "0"
EX : /etc/init.d/sshd status
openssh-daemon (pid 3465) is running...
QMAIL, -Number mail's in queue.
i have already created shell script. but its showing correct status or not. i can not find out.
SSH, #netstat -ta | grep ESTABLISHED | grep ssh
FTP, # netstat -a | grep ESTABLISHED | grep ftp
SMTP, # netstat -anp | grep ":25 " | grep LISTEN
POP3, # netstat -anp | grep ":110 " | grep LISTEN
The port a service is listnening in is specified either in the configuration files or in /etc/xinit.d.
For instance, ssh has its configuration files in /etc/ssh. sshd_config is the file where the listening port is specified, so looking for the port there will give you the answer you are looking for whenever the service has been started with the standard configuration files. Otherwise, you will have to ps the ssh process, grep the specific config file that has been used to start it, and grep the port in that file. Then check that port with your query.