11-01-2012
Search a string and send the line containing it
Folks,
Need a script which searches for a string and send line containing the string to the mail.
The requirement is like this :
file abc.log containts below text :
"error occurred due to the code 3456 and kill the process to recover it"
1. search for string "3456" and send entire line "error occurred due to the code 3456 and kill the process to recover it" to my email id.
Any help !!!
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text.
An example of 4 lines in my file is:
1. MatchText_randomNumberOfText moreData ReplaceMe moreData
2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies
2. Shell Programming and Scripting
Hi,
I need to find if there is any error in the last few lines of the log file and send a mail accordingly.For example,
Following errors can be logged in the log file.
ERR_1="DB Connection not established"
ERR_2="Server Unloading"
I need to find if these errors are found in the log file and... (1 Reply)
Discussion started by: AnneAnne
1 Replies
3. Shell Programming and Scripting
Hi Guys,
I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same.
can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies
4. Shell Programming and Scripting
I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios.
Cat test
Nov 10, 2012 5:17:53 AM
INFO: Request Type
Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies
5. UNIX for Dummies Questions & Answers
Hi All,
I need script which should search for the "reason code" and it should send mail with its preceding line as well as the line below it.(first line before it and line after it)
I used below script but it is printing the whole lines inside it, your help is appreciated:
cd... (3 Replies)
Discussion started by: rockingvj
3 Replies
6. Shell Programming and Scripting
I am having a text file which is having more than 200 lines.
EX:
001010122 12000 BIB 12000 11200 1200003
001010122 2000 AND 12000 11200 1200003
001010122 12000 KVB 12000 11200 1200003
In the above file i want to search for string KVB and add/replace... (1 Reply)
Discussion started by: suryanarayana
1 Replies
7. Shell Programming and Scripting
Dear All
I am having a text file which is having more than 200 lines.
EX:
001010122 12000 BIB 12000 11200 1200003
001010122 2000 AND 12000 11200 1200003
001010122 12000 KVB 12000 11200 1200003
In the above file i want to search for string KVB... (5 Replies)
Discussion started by: suryanarayana
5 Replies
8. Shell Programming and Scripting
Hi,
Need your help for this scripting issue I have. I am not really good at this, so seeking your help.
I have a file looking similar to this:
Hello, i am human and name=ABCD.
How are you?
Hello, i am human and name=PQRS.
I am good.
Hello, i am human and name=ABCD.
Good bye.
Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies
9. Shell Programming and Scripting
Hello,
I wanted to search specific string in the acitve log file and send an email if the search string found in the log.
Log file is written by application all the time. So, script has to search if any new log entry has the specific string for example " sample exception" and send an email. (1 Reply)
Discussion started by: balareddy
1 Replies
10. UNIX for Dummies Questions & Answers
Hi Everyone,
I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file.
I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies
vxsited(1M) vxsited(1M)
NAME
vxsited - site monitoring daemon
SYNOPSIS
/etc/vx/bin/vxsited [mail_address...]
DESCRIPTION
The vxsited daemon monitors Veritas Volume Manager (VxVM) for disks being attached, and reattaches a detached site if the disks that belong
to that site become accessible.
vxsited analyzes the output of the vxnotify command, and waits for a failed disk to attach. When a disk is attached, vxsited attempts to
online the disk, and tries to reattach the failed site. If a site is successfully reattached, vxsited starts recovery using vxrecover, and
sends mail to root (by default) or to other specified users.
Mail Notification
By default, vxsited sends mail to root with information about the disk status of any attempts to reattach the site. To send mail to other
users, add the user login name to the line that starts vxsited in the startup script, /etc/init.d/vxvm-recover, and reboot the system. For
example, if the line appears as:
nohup vxsited root &
and you want mail also to be sent to user1 and user2, change the line to read:
nohup vxsited root user1 user2 &
Alternatively, kill the vxsite process, and restart it from the command line with the required mail addresses as arguments.
The mail notification has a format that is similar to the following:
Subject : Volume Manager site reattach on host hostname
Reattached site sitename in disk-group diskgroup
Reattachment Procedure
If a disk from a detached site becomes accessible again, vxsited checks whether the relocation daemon, vxrelocd, is running. If vxrelocd
is running, vxsited attempts to reattach the site. The relocation daemon can then try to relocate the failed subdisks using space on the
available disks in the disk group. If the failed objects are successfully relocated, vxrelocd changes the state of the site to RECOVER,
and starts the recovery of volumes at the site. When all the plexes at a site have been recovered, the plexes are put into the ACTIVE
state, and the state of the site is set to ACTIVE.
If vxrelocd is not running, vxsited only reattaches a site when all the disks from that site become accessible. After successfully reat-
taching a site, vxsited changes the site state to ACTIVE, and initiates recovery using vxrecover. When all the plexes from a site have been
recovered, the plexes are put into the ACTIVE state, and the state of the site is set to ACTIVE.
vxsited does not attempt to reattach a site that has been explicitly detached by an administrator. The state OFFLINE is set for sites that
have been detached by using the following command:
vxdg -g dg_name detachsite sitename
Disabling vxsited
If you do not want a site to be recovered automatically, kill the vxsited daemon, and prevent it from restarting. To kill the daemon, run
the following command from the command line, and locate the process table entry for vxsited:
ps -ef
Execute the command:
kill -9 PID
Substitute the process ID of the vxsited process for PID. To prevent vxsited from being restarted, comment out the line that starts
vxsited in the startup script /sbin/init.d/vxvm-recover.
FILES
/sbin/init.d/vxvm-recover The startup file for vxsited.
SEE ALSO
kill(1), mailx(1), ps(1), vxdg(1M), vxrelocd(1M), vxintro(1M), vxnotify(1M), vxrecover(1M)
VxVM 5.0.31.1 24 Mar 2008 vxsited(1M)