1

I have written the below script to check whether my server running fine or not.But it is not properly working.It always showing Not runing even if it is running fine.Also the telnet in the script is not running working properly .Can any one help?

#!/bin/sh
export smtp=smtprelay.intra.xxx.com:25
Connect_redmine(){
telnet redmine.intra.xxx.com 443 <<EOF
exit 1;
EOF
}

Connect_redmine>/home/ssx00001/log_connect.txt
grep "Connected" /home/ssx00001/log_connect.txt
status=$?
if [ $status == 0 ]; then
echo `date`  "Redmine PROD server is running fine"|mailx -r Redmine@xxx -s "Redmine PROD server is running" [email protected]
else
echo "Redmine PROD server  is not Running"|mailx -r [email protected] -s "Redmine PROD server is not running" [email protected]
fi
2
  • Please show contents of /home/ssx00001/log_connect.txt. Commented Aug 9, 2014 at 7:45
  • It is empty .The script is not able to append the telnet result to the File. Commented Aug 10, 2014 at 8:03

1 Answer 1

3

A couple of questions first:

1] What does redmine do? Is it just a HTTPS server?

2] If [1] is true, can you do a wget of the index page, and use the result of that? It should be a lot easier to parse.

3] Telnetting into a HTTPS server, as far as I know, won't work, because it's not doing any of the handshaking that would be necessary for an SSL connection (which needs to occur before any content will be sent).

Using wget, you can do something like this:

wget https://redmine.intra.xxx.com/index.html

if [[-f "index.html" ] && [ -s "index.html" ]]

then

# The service is live

else

# Something is wrong

fi

Sign up to request clarification or add additional context in comments.

6 Comments

Redmine is a bugtracking tool and it is onfigured in HTTPS. The above getting error is bcoz of port number 443 is not working in telnet.But I dont know hw to resolve it
See number [3] for the reason that telnet isn't working. Can you do nr 2?
@roelfos: It (telnet) was working fine earlier.But now it is not working.
Can you post a log? I was wrong earlier - telnet will connect, it just won't go any further like you could with a normal HTTP server.
I still think this is a very kludgy approach, and would rather attempt to just retrieve the index.html file, or any artefact on the first page using curl or wget. You can then just check for existence and non-zero filesize, and act accordingly.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.