Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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...
SSH,
FTP,
SMTP,
POP3, and
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 output is : tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3017/sendmail: acce
This command checking POP3 status by Port number , Incase any one can change the port number how can i find out, the POP3 server LISTEN or NOT.
this same procedure i need SMTP, FTP, SSH.
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.
Or you have to assume sendmail is configured to listen on (some) port for POP3 and parse the output of /etc/init.d/ssh status to determine whether sendmail is running.
Please use [code][/code] tags around your code and data, to preserve formatting and to improve readability. Please do not use quote tags, colors, or other fancy formatting.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.