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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting write the script to get the file size and sends an email
# 8  
Old 08-12-2008
I think jim meant:

Code:
    /usr/bin/mailx -s 'file too big' abc@xyz.com < big.txt

Hopefully you didn't run that example as root or you will have overwritten your /usr/bin/mailx binary.

Last edited by Annihilannic; 08-12-2008 at 10:58 PM.. Reason: correct source of error
# 9  
Old 08-12-2008
ya thanks for the correction...
# 10  
Old 08-13-2008
Thanks for your reply.

it works fine. but to run this script I have to go the particular folder and it gives all the files which are more than 10MB in size. But what i need is script which I can run from my home directory and get *.txt files in /var/opt/abc/xyz and send an email when those *.txt file increased to 10MB.
# 11  
Old 08-14-2008
So just change the /path/to/file in Jim's solution to the directory you want to search, and change the filename.whatever to '*.txt (you need the quotes to prevent it being expanded by your shell).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

can't write file size more than 1G

running aix 7.1 ... # lsfs -q /admin/sft Name Nodename Mount Pt VFS Size Options Auto Accounting /dev/lv01 -- /admin/sft jfs 41943040 rw yes no (lv size: 41943040, fs size: 41943040, frag size: 4096, nbpi: 4096,... (3 Replies)
Discussion started by: ppchu99
3 Replies

2. Shell Programming and Scripting

how to write script to change email address

we have 4000 html pages that need an email address changed. eg) company@yahoo.com to company@hotmail.com we only want the file modified date to be changed when there has been a change to the file. Should I be using grep? I fairly new to UNIX and was told to using something like... (2 Replies)
Discussion started by: mchelle_99
2 Replies

3. Shell Programming and Scripting

Script to read file size and send email only if size > 0.

Hi Experts, I have a script like $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 ... (5 Replies)
Discussion started by: welldone
5 Replies

4. Shell Programming and Scripting

Script to Alert a file and sends an email

Hello All, I need a script which alerts me when a files arrive in a directory. I don't need every file. but i need some specific pattern file. And i need to get automatic email gettin as an alert For Example: /a/b/c/ : directory format of file should take regualr expression or manually... (2 Replies)
Discussion started by: krux_rap
2 Replies

5. UNIX for Dummies Questions & Answers

BASH script that sends text message or email

Hi, I have a BASH shell script that batch processes data. I often start this script before I leave to go home for the day, and leave it processing over night. It has come to my attention that it would be very useful for me to add the capability of making the script notify me about certain things... (2 Replies)
Discussion started by: msb65
2 Replies

6. Shell Programming and Scripting

Need to write script to send an email for password reset.

Hi all, Please suggest I want to write a scritp which will send a email to my mail address before the time duration of the password reset, Should write mail stating that your password will expire in so and so days"" Rgds:b: Ann. (2 Replies)
Discussion started by: Haque123
2 Replies

7. Shell Programming and Scripting

to write a script to compare the file size in the current directory and previous dir

hi, i am new to this site. i want to write a script to compare the file size of the files in the current dir with the files in the previous directory. the files name will be same, but the filename format will be as xyzddddyymm.txt. the files will arrive with the month end date(i want to... (5 Replies)
Discussion started by: tweety
5 Replies

8. Shell Programming and Scripting

how to know if the mailx command really sends the mail to the email address?

Hi guys, I have a question about the returning message of the mailx command. if I run a mailx command, how can I know if the email has been sent to the email address? If the email address doesn't exist, is there any error message returned? If yes, how can I get the error message? Thanks... (3 Replies)
Discussion started by: sheenshine
3 Replies

9. Shell Programming and Scripting

Running script that sends an html formatted email fails when its run as cronjob

Hi Im very new at working with unix and this problem I simply can not understand. I know there are a lot of threads about problems with shell scripts behaving differently when run from a terminal and from a cronjob. I have tried everything(almost) but I still havent cracked this problem. Im... (15 Replies)
Discussion started by: Nightowl
15 Replies

10. Shell Programming and Scripting

How to write a shell script to send an email to an id

Hi all, I want to know how to send an email using shell script ..... I tried a command call mail but it did not work.. Please any one reply.. With example if you know thanks.. Madhu (4 Replies)
Discussion started by: madhumathikv
4 Replies
Login or Register to Ask a Question