I got a problem and stuck to filter a log file, called it as "sample.log". This "sample.log" file is being generated by "script A". The "sample.log" look like below:
What i try to do is,Since the "sample.log" is actively growing up. i need to
1) Grep the the value failed and also all the required data. i should get like below:-
2) and email it to the me as an alert.
P/S this script will run in cron to actively monitor the "failed" data.
May be somebody cay help me on figure it out how can i do this.
Currently what i have is:
1) tail -f sample.log | grep failed >> samplelog.failed
## but i stuck at here because tail -f cannot output to other files, i tried but failed, no output has been generate.
#!/bin/bash
>error_log
for s in `cat s.txt`
do
uptime $s >>error_log
echo $s >>error_log
done
The above code produce output with server name and its uptime in 2 different lines .My requirement is to have the same in one line . Please assist (3 Replies)
Dear Team,
Below is the list of steps i need to perform manually as of now and completely new to shell scripting, could you help in writing a shell script to perform the below procedure?
1. Log in to primary DNS server
2. Check /etc/named.conf if zone is already created (grep –i... (2 Replies)
Hi, I'm very new to this, so bear with me please.
I want to write a sh script (or if there's a better format please let me know) that allows me to, when I run it, print the date to a file (1.out) take 2 arguments (files a.fa and b.fa), run them with another program, outputting to 2.out, and then... (2 Replies)
Hi, guys:
I am writing my own shell using c. I meet with two problems.
First, when I use tcsetpgrp system call to move a background job to foreground, when this job finishes, my shell program also exit. What is the problem for that?
Second, when I use signal , if the child has its own... (1 Reply)
Hi
I have two files a.log and b.log . i need to append a.log and b.log so that at the end of first line in a.log i need the append the data of first line from b.log and end of the second line in a.log i need to append the data of second line from b.log and so on up to the end of the file
can... (3 Replies)
I am trying to update a script which I had created to monitor tablespace usage.
Originally the sql spooled out to a text file anything with more than 75% used.
I have been asked to change this.
Now the sql must spool out all tablespaces.
The script I have to write should scan the file for... (4 Replies)
Hi,
I am a new for shell script. i need to write script using the following commands
cd /usres/test
# create directory
mkdir temp+DATE( i need to append date )
#moving files from one directory to this directory(we need to check total files in source and taget)
cd /users/sample
... (2 Replies)
Hello ALL,
I am fresher in Unix . i need help to write small shell script . Please help me unix guru.
I am developing the internal site in my office . the data files are generated in one directory everyday .
I have to write shell script to sort those files and put it is internal site .
... (3 Replies)
How to write a shell script file to read 5 numbers using a while loop. Finding the average, maximum and minumum for the numbers.
Any help would be great. (1 Reply)