LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-09-2006, 07:14 AM   #1
imagineers7
Member
 
Registered: Mar 2006
Distribution: BackTrack, RHEL, FC, CentOS, IPCop, Ubuntu, 64Studio, Elive, Dream Linux, Trix Box
Posts: 310

Rep: Reputation: 30
Need to write a bash script


Hello all,

I wanted to write a bash script which would connect to different mail, ftp, and web servers to make sure those are alive.
I have written a simple script to know if a server is live using ping -c 1 and if exit status is 0 it assumes it is live.
What command I should fire in order to know if smtp, web ,ftp server is alive

Thanks in advance
 
Old 05-09-2006, 07:27 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Netcat would help you
Code:
echo "quit" | nc $IP ftp
echo -e "HEAD / HTTP/1.0\n\n" | nc $IP www
echo "HELLO" | nc $IP smtp
Then in the responses you should check for a pattern, using sed for example

There are very good pre-made scripts that do this, I am looking in my bookmarks.

Last edited by nx5000; 05-09-2006 at 07:30 AM.
 
Old 05-09-2006, 07:34 AM   #3
imagineers7
Member
 
Registered: Mar 2006
Distribution: BackTrack, RHEL, FC, CentOS, IPCop, Ubuntu, 64Studio, Elive, Dream Linux, Trix Box
Posts: 310

Original Poster
Rep: Reputation: 30
Thumbs up Hooray NX5000

Hats of nx5000,

You have just posted your ONE THOUSAND'TH message
it was lucky me!!!!!!!!!!!!!!!!!!!!!

Thanks for your reply and please find out those scripts for me in your bookmarks,


Thanks for your time again

Dont forget to have a celebration time for your 1000'th post
 
Old 05-09-2006, 07:41 AM   #4
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Yeah yeah I've just been writing 20 posts in 4 hours to see this number. Now I'm looking for 10000 posts. Until then, the beer will flow!!

Before I get drunk, I think the app is:

swatch http://freshmeat.net/projects/swatch/

I'm not 100% sure its the app I was looking for, there is another one I can't find.. I'll post if I find

Otherwise do your own, using netcat.

ps: imagineers7 , you also have to drink a beer btw

Last edited by nx5000; 05-09-2006 at 07:42 AM.
 
Old 05-09-2006, 07:56 AM   #5
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
This is the one I was looking for... easy name but hard to remember
http://freshmeat.net/projects/checkservice/
 
Old 05-09-2006, 11:17 PM   #6
imagineers7
Member
 
Registered: Mar 2006
Distribution: BackTrack, RHEL, FC, CentOS, IPCop, Ubuntu, 64Studio, Elive, Dream Linux, Trix Box
Posts: 310

Original Poster
Rep: Reputation: 30
Cool

Hello NX5000,

Thanks for the links.
I thinks checkservice was the thing I was looking for, (although I am going {2 try } to write my own script using nc)
Also found swatch a useful app.

Thanks again, Thanks for your time


_____________________________________
You said:- "was there for 3-4 hours to see the number"
Me:-"was there to be a member"
i.e to cross the figure 30
Beer with double reasons of celebrations!

Last edited by imagineers7; 05-09-2006 at 11:19 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write a bash script to replace all "KH" to "K" in file ABC??? cqmyg5 Slackware 4 07-24-2007 09:00 AM
Write a script to send an email from bash kpelczar Linux - Software 5 02-09-2005 04:19 PM
Bash: how to write a wrapper script? J_Szucs Programming 0 01-29-2005 05:50 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
Anoyone willing to write a BASH script for me? pilot1 Programming 4 09-16-2003 08:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration