I have a log file that i'd like to monitor for a string. Now the log file rolls over everytime the server is restarted, so i'm doing a reverse list and then reading the latest log file.
So for the code, the log file is 'test1.txt'.
I check for the string and pipe to black hole (> /dev/null)....and if this is true, I do the same again but this time I mail a message to the support team.
If this is false (||) I email to support team that no entry is found.
So far my code is:
when i have entered dummy error messages into my dummy file (test1.txt) i get them emailed to me.
however, my problem is that even if my dummy 'test1.txt' is blank, i still get a message saying that the error has been found and to investigate.
Hi Team -
I"m very new to Shell Scripting so I have a rather novice question. My forte is Windows Batch Scripting so I was just wondering what the Shell Script equivalent is to the DOS command %~n?
%~n is a DOS variable that dispayed the script name.
For instance (in DOS):
REM... (11 Replies)
I need to create shell script (check system ) to display the output to the console and write these output to a log file at the same time.
My shell script is like that
Main() {
....
....
}
MainIt takes about 30s to display all the output to the console.
Then I put this command to the... (4 Replies)
AM in need of some plugin/script that can monitor HP-UX file "/var/opt/resmon/log/event.log" .
Have written a scrip in sh shell that is working fine for syslog.log and mail.log as having standard format, have interrogated that to Nagios and is working as I required .
But same script failed to... (3 Replies)
Hi,
I am in trouble ... again :wall:
I formating a log file as .txt from Unix (solaris 9) and then I compress it with gzip and I use uuencode and send it in an email.
gzip -c ${fic_report} | uuencode Report_File.gz > ${attachment_file}
my problem is when I received the mail with the... (6 Replies)
Hi,
I have written a bash shell script. In order to create a log file when I run the script, as well as print the output to the terminal, I call it in the following manner:
my_shell_script 2>&1 | tee my_log_fileThis seems to work well. However, I have put some statements in the script to... (2 Replies)
Hi,
I have a problem with my logfile. I am redirecting my output to log file and when iam viewing as text doc it is looking with some nonsense characters...please do help me on this .thank you.
here is my logfile which it is showing different behaviour:
spawn
spawn minicom
Welcome... (6 Replies)
Hi all..
The following set of statements is used in a shell script to ftp a file to a remote machine
I want to redirect the ftp messages thrown by the first ftp statement to a log file. As you can see there is a logic downstream to decide if the ftp was a success or not. But i am not... (5 Replies)
I want to transfer files from ABC server to XYZ server in which i am successful. I would like to create a log file also by the name of current date. For some reason my script gives me an error on my scp -p command and it says LOCAL_LOG_FILE: not found and REMOTE_LOG_FILE not found. Any clues whats... (9 Replies)
On HP-UX, we add some our autostart scripts in the system script under /sbin/rc*.d directory. The output of application is redirected to /dev/null in our script,but once the application has been startup with the OS starting,its ouput is redirected to the /etc/rc.log finally and cause the rc.log... (2 Replies)