Script to automatically check ports in shell?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to automatically check ports in shell?
# 1  
Old 05-12-2008
Script to automatically check ports in shell?

Good day,

I'm new to linux environment...Is there any scripts available for me to check ports (lets say port 80 and 21) through shell with just a single commandline?

Any response is very much appreciated..
thanks
# 2  
Old 05-12-2008
check for what?
# 3  
Old 05-12-2008
Are you trying to say that you wanted to check for open ports on a certain machine? If that's the case you can use the nmap utility. Check it's manual.

Hope this helps.
# 4  
Old 05-13-2008
@DukeNuke2
check if the port connection of a particular ip/domain is okay or not...


@yongitz
i'll take alook on that...


tanx 4 ur response...
# 5  
Old 05-13-2008
Another easy way, to check port 80 for example:

Code:
if telnet hostname 80 < /dev/null 2>&1 | grep -q Connected
then
    echo its fine
else
    echo port 80 is down!
fi

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to check numerous ports / servers (Solaris native)

Hi I'd like to check that a bunch of firewall rules have been applied and, therefore, want to write a script that basically does the following: telnet serverA port1 telnet serverA port2 telnet serverB port1 telnet serverB port2 I would just compile the list in excel and run it as a... (2 Replies)
Discussion started by: jibberish
2 Replies

2. Shell Programming and Scripting

Shell Script to Automatically Read My Password

I have a shell script to run set of commands every week . I dont have a root access on the server but I can run the commands using pbrun cat myscript.sh * * * pbrun command.... each time I run the script , it asks me for my password then it executes fine. ./myscript.sh Password... (7 Replies)
Discussion started by: Sara_84
7 Replies

3. IP Networking

My router has UPnP, as do its work with ubuntu to automatically open ports

My router has UPnP,how to make it work with ubuntu to automatically open ports I try to open the following command " /sbin/iptables -I INPUT -d 0/0 -s 0/0 -p tcp --dport 21 -j ACCEPT" ,local only opens ,if i put the ip 192.168.1.68, it works correctly, if i`m put my external ip does not work,I... (9 Replies)
Discussion started by: dhalus
9 Replies

4. Shell Programming and Scripting

Shell script to automatically download files

I am new to shell scripting and need to write a program to copy files that are posted as links on a specific url. I want all the links copied with the same file name and the one posted on the webpage containing the url onto a specific directory. That is the first part. The second part of the script... (2 Replies)
Discussion started by: libertyforall
2 Replies

5. Shell Programming and Scripting

shell script that will automatically check if specifed user is log in or not, in 30 seconds

guys I need emergency help with below shell script assignment..am new to shell script Write a Shell script to automatically check that a specified user is logged in to the computer. The program should allow the person running the script to specify the name of the user to be checked, the... (2 Replies)
Discussion started by: gurmad
2 Replies

6. Shell Programming and Scripting

Shell script to invoke options automatically

i have a script which has 2 options. a b And a has 6 sub options. i want to write a script which will call the parent script and give options automatically. examle: linasplg11:/opt/ss/kk/01.00/bin # startup.sh /opt/ss/rdm/01.00 Please select the component to... (2 Replies)
Discussion started by: Aditya.Gurgaon
2 Replies

7. Shell Programming and Scripting

how to run shell script automatically

hi , i m trying to run bash scrip automaticially but i dont know how i can do this an anybody tell me how i can autorun shell script when i logon . thanks (9 Replies)
Discussion started by: tahir23
9 Replies

8. Shell Programming and Scripting

need help to write script to check the process health and automatically restart it

I am working on a project, which need to constantly watch the process, and check its status, if it was dead, it should be restart automatically. Please kindly refer me to URL which teach how to write this kind of script, or service. Thanks. (1 Reply)
Discussion started by: dragondad
1 Replies
Login or Register to Ask a Question