Sponsored Content
Top Forums Shell Programming and Scripting Script to read file size and send email only if size > 0. Post 302517993 by welldone on Thursday 28th of April 2011 12:04:39 PM
Old 04-28-2011
Script to read file size and send email only if size > 0.

Hi Experts,
I have a script like
Code:
 
$ORACLE_HOME/bin/sqlplus username/password # << ENDSQL
set pagesize 0 trim on feedback off verify off echo off newp none timing off
set serveroutput on
set heading off
spool Schemaerrtmp.txt
select ' TIMESTAMP                     COMPUTER NAME                        ERROR TEXT ' from dual;
select to_char(error_time,'MM-DD-YYYY.HH.MI.SS') ||'  ;  ' || trim(computer_name) || '  ;  '||trim(error_code)|| ' ; '|| trim(rpad(error_text,30)) from  ta_error_log where rownum <=1000 and error_time > sysdate -1;
spool off
ENDSQL
dt=`date|awk '{print $1}'`
sed '1,5 d' Schemaerrtmp.txt > Schemaerr.txt
cat Schemaerr.txt |mailx -s " SPEAR Error Log file!!!! " $MAIL_LIST

This script sends a message even if "Schemaerr.txt" file is empty/zero bytes.
Need to modify the above script so that it send message only if "Schemaerr.txt" size is > 0 or non-empty.

Please advice.

Thanks

Last edited by Scott; 04-28-2011 at 01:17 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

send file of size 0 with FTP on AIX

I'm using IBM AIX 5.2 to send file with ftp to other unix machine. The command is into a shell: ... ftp -n > outFtp 2> errFtp <<PARAM open $2 user $3 $4 put $1 $remote bye PARAM ... then i look at the size of errFtp and outFtp to see if there are some error message.... (4 Replies)
Discussion started by: gggarb
4 Replies

2. Shell Programming and Scripting

Email message if file size > 0 bytes

I want to create a script that emails a file created by Informix Ace if the file size is > 0. It is a list of exceptions. No exceptions...no message This does not work: THESIZE=`ls -lA /tmp/ds_treo.txt | awk -F' ' '{print $5}'` if then (cat $DSDIR/ds_treo.txt) | mail -s "Treo... (1 Reply)
Discussion started by: poste_d_ordure
1 Replies

3. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies

4. Shell Programming and Scripting

write the script to get the file size and sends an email

hi all Anybody have an idea to write the script to get the file size and sends an email when file size increse more than 10mb. thanks (10 Replies)
Discussion started by: s_linux
10 Replies

5. Shell Programming and Scripting

command to read file name and size

hi all, there is any command or anything we can use to read the file name and size. thanks (6 Replies)
Discussion started by: s_linux
6 Replies

6. Solaris

Directory size larger than file system size?

Hi, We currently have an Oracle database running and it is creating lots of processes in the /proc directory that are 1000M in size. The size of the /proc directory is now reading 26T. How can this be if the root file system is only 13GB? I have seen this before we an Oracle temp file... (6 Replies)
Discussion started by: sparcman
6 Replies

7. Shell Programming and Scripting

The scripts not able to make the file to size 0, every times it go back to its original size

#!/bin/sh ########################################################################################################## #This script is being used for AOK application for cleaning up the .out files and zip it under logs directory. # IBM # Created #For pdocap201/pdoca202 .out files for AOK #1.... (0 Replies)
Discussion started by: mridul10_crj
0 Replies

8. Shell Programming and Scripting

Read file and send email

I have a file like this. I need to ues this file to send emails to the appropriate ID/group. For instance in the first line - Subject should be --> "A1.csv - ABC" - Body should be --> File A1.csv has changed. - Email should be sent to A1@xyz.com,A3@xyz.com Lookup.csv: ... (1 Reply)
Discussion started by: vskr72
1 Replies

9. UNIX for Dummies Questions & Answers

Ls directory size reporting byte size instead of file count

I have been searching both on Unix.com and Google and have not been able to find the answer to my question. I think it is partly because I can't come up with the right search terms. Recently, my virtual server switched storage devices and I think the problem may be related to that change.... (2 Replies)
Discussion started by: jmgibby
2 Replies

10. UNIX for Beginners Questions & Answers

Shell Script to read hive table and send email

HI Team, I am working on reading hive table and send email in email body using shell script, can you please help on fixing the errors: I have 6 columns in my hive table and trying to send the email in the mail body. below script: #!/bin/bash hive -e 'SELECT count(*) from db.table' >... (4 Replies)
Discussion started by: Mi4304
4 Replies
GET-OUI(1)						      General Commands Manual							GET-OUI(1)

NAME
get-oui - Fetch the arp-scan OUI file from the IEEE website SYNOPSIS
get-oui [options] DESCRIPTION
get-oui fetches the Ethernet OUI file from the IEEE website, and saves it in the format used by arp-scan. The OUI file contains all of the OUIs (Organizationally Unique Identifiers) that have been registered with IEEE. Each OUI entry in the file specifies the first 24-bits of the 48-bit Ethernet hardware address, leaving the remaining 24-bits for use by the registering organi- sation. For example the OUI entry "080020", registered to Sun Microsystems, applies to any Ethernet hardware address from 08:00:20:00:00:00 to 08:00:20:ff:ff:ff inclusive. Each OUI assignment represents a total of 2^24 (16,777,216) Ethernet addresses. Every major Ethernet hardware vendor registers an OUI for their equipment, and larger vendors will need to register more than one. For example, 3Com have a total of 37 OUI entries. Organisations that only produce a small number of Ethernet devices will often obtain an IAB registration instead. See get-iab(1) for details. This script can be used to update the arp-scan OUI file from the latest data on the IEEE website. Most of the Ethernet addresses in use belong to an OUI registration, so this is the most important of the files that arp-scan uses to decode Ethernet hardware addresses. You should therefore run get-oui occasionally to keep the arp-scan OUI file up to date. The OUI data is fetched from the URL http://standards.ieee.org/regauth/oui/oui.txt and the output file is saved to the file ieee-oui.txt in the current directory. The URL to fetch the data from can be changed with the -u option, and the output file name can be changed with the -f option. The ieee-oui.txt file that is produced by this script is used by arp-scan to determine the Ethernet card vendor from its hardware address. The directory that arp-scan will look for the ieee-oui.txt file depends on the options used when it was built. If it was built using the default options, then it will look in /usr/local/share/arp-scan. OPTIONS
-h Display a brief usage message and exit. -f <fn> Write the output to the specified file instead of the default ieee-oui.txt. -u <URL> Use the specified URL to fetch the raw OUI data from instead of the default http://standards.ieee.org/regauth/oui/oui.txt. -v Display verbose progress messages. FILES
ieee-oui.txt The default output file. EXAMPLES
$ get-oui -v Renaming ieee-oui.txt to ieee-oui.txt.bak Fetching OUI data from http://standards.ieee.org/regauth/oui/oui.txt Fetched 1467278 bytes Opening output file ieee-oui.txt 9274 OUI entries written to file ieee-oui.txt NOTES
get-oui is implemented in Perl, so you need to have the Perl interpreter installed on your system to use it. get-oui uses the LWP::Simple Perl module to fetch the data from the IEEE website. You must have this module installed on your system for it to work. This module is available on most distributions, often called libwww-perl. It is also available in source form from CPAN. You can use a proxy server by defining the http_proxy environment variable. AUTHOR
Roy Hills <Roy.Hills@nta-monitor.com> SEE ALSO
arp-scan(1) get-iab(1) arp-fingerprint(1) http://www.nta-monitor.com/wiki/ The arp-scan wiki page. March 30, 2007 GET-OUI(1)
All times are GMT -4. The time now is 02:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy