LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-23-2010, 05:45 AM   #1
keimasi
Member
 
Registered: Dec 2010
Location: Iran, Tehran
Distribution: ubuntu
Posts: 31

Rep: Reputation: 0
Question linux code 4 checking up or down server



Hello dear frnds.
Plz help me if it’s possible 4 u
I wanna write a code in my linux in VIM editor that it must check a server by sending ping to it and send an e-mail to admin and aware him or her that server is down.
It is not complete, I know that. Wt should I do?
Plz guide me. Thanx a lot.
keimasi



#version 0.0001
#write by keimasi
#date 23 dec 2010
Clear
read -p “ please enter your IP : “ IP
ping -c1 $IP
if [$? !=0]
then
mail -s “ server is down” admin
fi
 
Old 12-23-2010, 07:27 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Main issue I can see is your if syntax. You need spaces between each operator our it still not function at all.
 
Old 12-23-2010, 07:34 AM   #3
keimasi
Member
 
Registered: Dec 2010
Location: Iran, Tehran
Distribution: ubuntu
Posts: 31

Original Poster
Rep: Reputation: 0
so what should i do 2 complete this ? please guide me more.
 
Old 12-23-2010, 07:37 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Er,... You should put spaces between each part of the if statement, like I said.
 
1 members found this post helpful.
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
New to this Forum checking out - interested in Suse Linux - hosting Virtual server eforbay LinuxQuestions.org Member Intro 0 03-31-2009 02:50 AM
Wget or cURL code for checking changes to a web page? ewingtux Programming 2 12-16-2008 04:46 PM
PHP variable code works on Windows Server but not Linux Server Russianspi Programming 2 07-05-2007 01:23 PM
LXer: 2x Opens Source Code to its NX Based Terminal Server for Linux LXer Syndicated Linux News 0 08-31-2006 12:54 PM
Source code syntax checking eqxro Linux - Software 0 09-21-2004 11:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:37 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