![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do I check using shell-script if a website is available / responding? | Neil_mw | Shell Programming and Scripting | 3 | 07-22-2008 12:38 PM |
| Script to check processes and send an email | heprox | Shell Programming and Scripting | 1 | 11-06-2006 01:17 AM |
| check the status and send an email with status | isingh786 | Shell Programming and Scripting | 3 | 12-29-2005 07:22 PM |
| Send email where # is in the email address - Using Unix | jingi1234 | UNIX for Dummies Questions & Answers | 1 | 05-23-2005 12:23 PM |
| Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win) | Vetrivela | UNIX for Advanced & Expert Users | 2 | 02-15-2005 10:43 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
if {ping -c 1 www || { "Destination Host Unreachable" ; }}
then { echo "neveikia senas-pastas, web serveris" | mailx -s "Senas web serveris" mail } endif; this is my script but it does not work... ![]() this script will be used to check if website is online if not then sends an email... please help Last edited by big_nobody; 08-29-2008 at 10:40 AM.. |
|
||||
|
Which shell is this? Apart from using endif instead of fi the syntax isn't technically wrong for Bourne shell, but definitely ... eerie. Code:
if ! ping -c 1 www; then mailx -s subject mail <<__HERE Body of email message __HERE fi This can be shortened to the slightly more obscure Code:
ping -c 1 www || mailx -s subject mail <<__HERE Body of email message __HERE If you specifically want to look for "Destination host unreachable" (which I do not recommend at all) the syntax for that would be something like Code:
case `ping -c 1 www` in *"Destination host unreachable"*) mailx ... ;; esac or Code:
if ping -c 1 www 2>&1 | grep "Destination host unreachable" >/dev/null; then mailx ... fi |
|
||||
|
#!/bin/bash
wget -t 1 WWW if [ -f index.html ] then rm -rvf index.html else echo "does not work website in old-server" | mailx -s "Server named old-server does not work" user@host fi Last edited by big_nobody; 09-01-2008 at 06:06 PM.. Reason: hide website and email (security) |
|
||||
|
i used this script, because i need to know if PC is available... if server gives some error generated in index.html it is good, because on this PC are about 20 virtual sites in apache. if one is down others are in use
and ping goes only to the router... and this PC/server is under 2 routers. big thanx for help to you all |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|