Sponsored Content
Top Forums Shell Programming and Scripting basic server check script - help Post 302585824 by Habitual on Thursday 29th of December 2011 10:20:30 AM
Old 12-29-2011
basic server check script - help

Hello Fellow bash enthusiasts...

I am stuck on this local script and could use some fresh eyes on this code.
Code:
#!/bin/bash
MAIL_ME="jj@uberdork.com"
MAIL_SUBJECT="Norveld_Server_needs_attention"
SERVER_DATE=$(TZ=PST8PDT date)
echo $(ServerTZ=PST8PDT date) - Web Server Check = $(curl -Is http://xxx.xxx.xxx.xxx | \grep -E '^Server' | cut -c9-) >> /home/jj/Documents/cirrhus9/Accounts/Norveld/3WeekTest/norveld.test
if [ $? -eq 0 ] ; then
 exit 0
 else
 if [ $? -eq 1 ] ; then
 echo "Norveld_Server_Check - FAILED" on $SERVER_DATE | mail $MAIL_ME -s $MAIL_SUBJECT
 exit 1
 fi
 fi
done
#EOF

PING IS NOT AN OPTION'
Server when it's borked will ping,
but be unresponsive, so I ask the Webserver what software it's using with
Code:
curl -Is http://xxx.xxx.xxx.xxx | \grep -E '^Server' | cut -c9-

which returns "Microsoft-IIS/7.5" and works even if the server is unresponsive through usual means.

This runs under my cron every minute.
There's only 1 problem, server has been up/down for awhile and I NEVER get an email.

Code:
telnet xxx.xxx.xxx.xxxx 80

is an option, but I have zero experience with how to handle the response from the server. or
Code:
wget xxx.xxx.xxx.xxx/index.html


Whatever method I use to check for responsiveness, I have to get an email
as the desired email address.

local: GNU bash, version 4.1.10(1)-release (i586-suse-linux-gnu)
Remote: Windows Server 2008 R2 (64bit) with IIS.

Thanks.

Happy New Year!

Last edited by Habitual; 12-29-2011 at 11:25 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to check running processes on remote server.

Hi, I am trying to write a script, which queries a db to get the names of processes, stores it in a file and then checks if that process is running on a remote server. However I am not getting it right, could anyone help me out. #!/bin/sh echo "select Address from Device where Cust =... (5 Replies)
Discussion started by: amitsayshii
5 Replies

2. Shell Programming and Scripting

Help with a very basic network check script

i figured it out thanks though! (0 Replies)
Discussion started by: anon0mus
0 Replies

3. UNIX for Advanced & Expert Users

how to check if a process is running in a server from shell script.

I want to write a unix shell script that will check if a process (say debu) is running in the server or not. If no , then send a mail to the corresponding person to start the process??? (2 Replies)
Discussion started by: debu
2 Replies

4. Shell Programming and Scripting

Script to check file update on ftp server

Hi everybody, Is there a way to do a stat of files on a ftp server? I have a database which is populated by the contents of these files. I want to setup a crontab to check if there has been an update to these files. If the file has been updated I will download it and then update my database. ... (2 Replies)
Discussion started by: z1dane
2 Replies

5. UNIX for Dummies Questions & Answers

Basic Script to check for a file

Hello, Little new to unix scripting. I need to create a script that will do the following. Check in a directory for a file that will be present between 19:00 and 23:00. If the file is present a e-mail then needs to be sent to myself confirming. I did write something basic...as below... ... (3 Replies)
Discussion started by: Thundercat1
3 Replies

6. Shell Programming and Scripting

UNIX script to check file and start the informatica server

Hi Rockers, I hope u r dng good one. I have a one question is in unix with informatica . I need a unix script to check whether particular file exists in the folder , If it means we have a informatica server , so we can start the informatica server by accessing that file. Every week we have... (0 Replies)
Discussion started by: gurukrishnan
0 Replies

7. Shell Programming and Scripting

Shell script for Server Mount Point space check

Does anybody have anything I can use to help me out with this one? (4 Replies)
Discussion started by: lbone007
4 Replies

8. Shell Programming and Scripting

*ix script to check port of client server and return output

Hello EveryOne, I am new to *ix. some could help to write a script. Problem :- Have to ssh to so many client and check port or filesystem usage, so thinking to automate using script. What i Need:- when i run script on my Launchpad server, it should Should ask and SSH to user provided... (3 Replies)
Discussion started by: MeFirst
3 Replies

9. Shell Programming and Scripting

Help with shell script to check the tcp network connectivity between server

Hello, I have a requirement to check the tcp network connectivity between server it's running on and the list of host's and ports combination. i have written the below code but it doesn't work, but when i execute the nc command outside the script it works fine. please help me where i am... (8 Replies)
Discussion started by: sknovice
8 Replies

10. Shell Programming and Scripting

Script to check server-name and come out

Hello, I am not efficient in script, so need some help to create a small script. I have file, which have list of all IPs. All those IPs can be connected from a gateway server with "sudo ssh 10.63.xx.xx". We do not have reverse lookup for IPs, so I want script to login to each server, return... (1 Reply)
Discussion started by: solaris_1977
1 Replies
INSTALLSIEVE(1) 					      General Commands Manual						   INSTALLSIEVE(1)

 *

NAME
installsieve - user utility for managing sieve scripts SYNOPSIS
installsieve DESCRIPTION
installsieve is a utility that allows users to manage their sieve scripts kept on the server. OPTIONS
-v <name> View script with the given name. The script if retrieved sucessfully is output to standard output. -l List all of the scripts currently on the server. If one of the scripts is active a arrow is printed indicating that it is the active script. -p <port> Port to connect to. If left off this defaults to "sieve" as defined in /etc/services. -i <file> Install a file onto the server. If a script with the same name already exists on the server it is overwritten. Upon sucessfully putting the script on the server the script is set active. If <file> has the extension .script it is chopped when put on the server since sieve names may not contain a '.'. -a <name> Set <name> as the active script. The list of available names can be obtained from the '-l' option.. -d <name> Delete the sieve script on the server with <name>. -m <mechanism> Force installsieve to use <mechanism> for authentication. If not specified the strongest authentication mechanism is chosen. -g <name> Get the sieve script with <name> and save it to disk with a ".script" extension. If a file with that name already exists it is overwritten. -u <user> Userid/Authname to use for authentication; by default, the current user. CMU
Project Cyrus INSTALLSIEVE(1)
All times are GMT -4. The time now is 04:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy