very new to this game so excuse my ignorance. I need to create a script that simply greps for a text string and then outputs a message depending on whether the text string is there or not. The script I have setup is below, but whenever I run it I get the following error:
Code:
./LogCheck.sh[8]: TIMEOUT=: not found
./LogCheck.sh[10]: ${TIMEOUT}: bad substitution
Sure this is a schoolboy error, but any advise greatly appreciated
Thanks,
A.
Code:
#!/bin/ksh
##################################################################################################
#
# This script checks the log file for timeouts #
##################################################################################################TIMEOUT=`tail -5000 /dir1/logs/logfile.log | grep "has timed out and is not currently tradeable" | tail -1`;echo ${TIMEOUT};if [ ! -z ${TIMEOUT} ]; then
echo "Timeout Alert";
else
echo "No Timeouts";
Moderator's Comments:
Please use [code] and [/code] tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks.
Last edited by zaxxon; 01-20-2011 at 08:03 AM..
Reason: code tags
Hi everyone,
Im trying to write a Shell script that basically creates a set of files based on a file with many records. For example if a file called dummy has the following content:
a.txt
1st line of a's text file
2nd line of a's text file
3rd line of a's text file
b.txt
1st line of b's... (8 Replies)
Hi,
I have a problem with a simple script I am trying to write. I want a user to type grep, sed commands that are then stored in variables. Those variables are stored in a function, and the function is then called to execute the commands. The idea is that the user does it step by step.
... (4 Replies)
Hello
I do want to write a script which will check any errors say "-error" in the log file then have to send email to the concern person . And the concern person will correct the error .
Next time if the script runs eventhough the error has been corrected it will ... (1 Reply)
Hi,
I am writing a shell script that checks catalina logs on a production system and mails me if it detects errors.
It greps the logs for known errors which i have defined as variables.
The problem is the logs are huge, approx 30,000 before they rotate.
So I am forced to use grep instead... (3 Replies)
Hi,
I have written the following shell script -
Error_String="error"
var1="| grep -v note1 | grep -v note2"
grep -i $Error_String /users/mqm/Pwork/Err/*.out $var1
The above script gives error saying "grep: can't open |
grep: can't open grep
grep: can't open -v" etc
In my program... (3 Replies)
Hi guys, I have written this script, however the outcome is invalid. It contains grep search that is not needed:
Script:
#!/bin/bash
#this is a test script
FILES=$(ls /home/student/bin/dir1/*)
GREPFUNC=$(grep -E -i "login|Successfully" ORProxyTC`date '+%m%d%Y'`*.txt/ ${FILES})... (14 Replies)
I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts.
Here is my script
#!/bin/csh -f
source .orapass
set user = $USER
set pass = $PASS
cd /opt/data/scripts
echo... (2 Replies)
Hi guys - below is my script that is checking for current file, size and timestamp.
However I added a "grep" feature in it (line in red), but not getting the desired result.
I am trying to acheive in output:
1. Show me the file name, timestamp, size and grep'ed words
It would be a... (2 Replies)
HI Guys hoping some one can help
I have two files on both containing uk phone numbers
master is a file which has been collated over a few years ad currently contains around 4 million numbers
new is a file which also contains 4 million number i need to split new nto two separate files... (4 Replies)
Discussion started by: dunryc
4 Replies
LEARN ABOUT HPUX
ppp.dialers
ppp.Dialers(4) Kernel Interfaces Manual ppp.Dialers(4)NAME
ppp.Dialers - PPP dialer description file format
DESCRIPTION
The file describes how to dial each type of modem attached to the UNIX system that is to be made available for outbound PPP calls. exam-
ines it when placing a call to a neighboring machine.
When selects a line from it uses the field to select an entry in from which it uses the field to select an entry in then interprets the
field from that dialer description.
Format
Entries are one to a line; blank lines are ignored. Comments begin with a and extend to the end of the line. Upper/lower case distinc-
tions in the dialer field are significant for matching purposes, as are strings in the chat script. Fields on a line are separated by hor-
izontal white space (blanks or tabs). If a chat script ends with a backslash the next line is considered a continuation of the chat
script. Continuations may only occur in the midst of a chat script.
Each entry must contain these fields, in this order:
dialer The name of this dialer, to be matched against the dialer field in
chat-script A description of the conversation that holds with the modem.
Chat Script Particulars
A chat script takes the form of a space-separated list of expect-send pairs. Each pair consists (at minimum) of a field to expect the end
to send, then a field to send in response. Unless a string ends with will follow it by sending a carriage return character (ASCII 0x0d).
Chat scripts are or where the following the hyphen is executed if the preceding fails to match received text.
Certain special words may be used in the chat script to control the behavior of as it attempts to dial. Both ABORT and TIMEOUT must be in
the phase of the chat script.
If sees abort-string while executing the remainder of the chat script, abort the dialing attempt and note the
failure in the log file.
While executing the current chat script, wait timeout-time
seconds for a response before considering the dialing attempt to have timed out. Writes have a fixed
60-second timeout.
The expect-send couplet of 'sets the line parity accordingly:
Set transmission parity based on the parity observed in characters
received in strings. This is the default.
Transmit characters with the parity bit set to zero (8 bits, no parity).
Transmit characters with the parity bit set to one.
Transmit characters with even parity.
Transmit characters with odd parity.
In the midst of either an string or a string, gets translated into the appropriate control character, and gets translated into x. Other
special sequences are:
Send or receive a space character (ASCII 0x20).
Send or receive a horizontal tab character (ASCII 0x09).
Send or receive a line feed character (ASCII 0x0a).
Send or receive a carriage return character (ASCII 0x0d).
Send or receive a backslash character (ASCII 0x5c).
Send or receive a carat character (ASCII 0x5e).
Send or receive the single character Ctrl-character (ASCII 0x00
through 0x1f).
Send or receive a character, specified in octal digits.
Pause for .25 second before proceeding (send only).
Delay for two seconds before proceeding (send only).
Send a break (.25 second of zero bits).
Disable hangups (sets CLOCAL or LNOHANG).
enable hangups (unsets CLOCAL or LNOHANG) (the default).
Don't append a carriage return character after sending the preceding string (send only).
Don't print succeeding send strings (e.g., a password) in any
debugging or logging output. Subsequent sequences toggle mode.
Insert the telephone number (found in the fifth field of
here.
EXAMPLES
#
# Dialers - PPP dialers file
#
#Dialer Chat script
T1600 ABORT NOsCARRIER ABORT NOsDIALTONE ABORT BUSY
ABORT RRING
RRING
RRING
ABORT ERROR TIMEOUT 5 "" AT OK-AT-OK
ATS111=0DTT TIMEOUT 30 CONNECT
#
T2500-PEP
ABORT NOsCARRIER ABORT NOsDIALTONE ABORT BUSY
ABORT RRING
RRING
RRING
ABORT ERROR TIMEOUT 5 "" AT OK-AT-OK
ATS111=0DTT TIMEOUT 30 CONNECTsFAST
#
USRv32bis
ABORT ERROR ABORT NOsANSWER ABORT NOsCARRIER
ABORT BUSY ABORT RRING
RRING
RRING
ABORT NOsDIALsTONE TIMEOUT 5 "" AT&F
OK-ATQ0-OK ATB0E0X7&B1&H1&I0&K3&R2&S1 OK-AT-OK
ATS01=1S02=255S19=0 OK-AT-OK ATDTT TIMEOUT 30
CONNECT
AUTHOR
was developed by the Progressive Systems.
SEE ALSO pppd(1), ppp.Auth(4), ppp.Devices(4), ppp.Filter(4), ppp.Keys(4), ppp.Systems(4).
RFC 1055. RFC 1144, RFC 1332, RFC 1548,
ppp.Dialers(4)