A script like this set up on ServerA should do the trick.
The 'date' variable at the top just creates a string via the 'date' command that consists of the year, month, date, hour, minute and second all run together. I went with this since you didn't specify any particular format, but this should do for most purposes (if the script only runs at most once per second, anyway).
The next three variables define the recipient, subject and body of the e-mail message. You can customise those all you like.
Finally, the variable 'server' defines the remote server that the 'ssh' command will use to connect to. You'll want to change this to the details of whatever ServerB is.
The basic idea of the script is that it connects to the remote server, and if the 'touch' command (or the 'ssh' command itself) returns a non-successful exit value for any reaason, it then proceeds to send the e-mail.
Here's an example session of it running, in a situation where the touch command at the remote end (which is really just 'localhost' in my test case) fails.
Just a minor addition: i'd call the ssh-facility this way to prevent problems in case keys are changed/deleted. Not allocating a terminal (-n) prevents problems when used inside pipelines:
A script like this set up on ServerA should do the trick.
The 'date' variable at the top just creates a string via the 'date' command that consists of the year, month, date, hour, minute and second all run together. I went with this since you didn't specify any particular format, but this should do for most purposes (if the script only runs at most once per second, anyway).
The next three variables define the recipient, subject and body of the e-mail message. You can customise those all you like.
Finally, the variable 'server' defines the remote server that the 'ssh' command will use to connect to. You'll want to change this to the details of whatever ServerB is.
The basic idea of the script is that it connects to the remote server, and if the 'touch' command (or the 'ssh' command itself) returns a non-successful exit value for any reaason, it then proceeds to send the e-mail.
Here's an example session of it running, in a situation where the touch command at the remote end (which is really just 'localhost' in my test case) fails.
Hi,
I have on Designdocument in that information is stored with in tabular format.I need Perl/unix script to read and write the data
using perl script?
Regards,
Ravi (4 Replies)
Hi,
I have on Designdocument in that information is stored with in tabular format.I need Perlscript to read and write the datausing perl script?
Regards,
Ravi (0 Replies)
Hello, I have a comma seperated data sheet with multiple fields of biological data. One column contains the ID name of the sample, where there could be more than one sample separated by a comma. I would like a script that reads this field, and for each sample ID, copies the entire line and writes... (18 Replies)
hi all
i have a problem how to read file location..I read file as FILE=/home/tmp/new.file.but t is not useful for me.But i want my script read file location where the file is and copy in directory at boot time. Every time of booting files are copied in respective folder.please help !!!!:) (2 Replies)
Hi,
We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
This is the code:
while test 1 -eq 1
do
read a
$a
if test $a = stop
then
break
fi
done
I read a command on every loop an execute it.
I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test.
For example echo hello.
Now the... (1 Reply)
Hi,
root@server] df -h
121G 14G 101G 12% /home
147G 126G 14G 91% /backup
We having our site files and images are storing in
/backup/home/user/files/ through symbolic link created in /home directory pointing in /backup directory as following.
root@server] cd /home... (1 Reply)
Hi All,
I want a script to test folder permissions.( to alert me if a folder /abc/xyz does not have 775 permissions). i want to test /abc/xyz is having 775 permissions or not if not it has to alert me.
Please help me ASAP
Thanks in advance (4 Replies)
Hi y'all...I've been wracking my brain over this very simple script that reads in a textfile and echos each line. But I keep getting an error.
Below is my script:
#!/bin/bash
while read myline
do
echo $myline
done < t_file-20080221.01.asc
The error I am getting is:
syntax error... (1 Reply)
Hello,
I am a Newbie in ksh Unix Script.
So I must write a ksh/sh script who read character at a position in a File. So also it must read all the lines who belongs at these characters , then write these lines in a another File.
Can you help me , or give little councils to advance with my... (5 Replies)