Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Check Error File attach and email zip file Post 303030953 by xgringo on Tuesday 19th of February 2019 05:33:39 PM
Old 02-19-2019
Check Error File attach and email zip file

I need something to say if these two file extensions exist in this directory *err and *rpt
zip up these files into one zip file and email them to me.

If they don't exist wait 2 hours and check again.... Not sure how to determine if I need to do an if then statement or a while true or a for loop.

If files exist, then do these commands..... sorry still a novice here.

Code:
 
for file in $optfiles; do
       find  $optfiles  | grep -P '\.rpt|\.err' | tar -cvzf optumerrors.gz -T - ;
       find -f $optfiles/*gz -exec mail -a $optfiles/*.gz -s "Op Error Files" jdaw@321example.com < /dev/null {} \;
       rm -f $optfiles/'\*err|\*rpt' ;
       mv *gz $optfiles/backup/ ;
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

check if exists a .ZIP file and unzip it using ftp

hi this is my question i have my script what have to verify the existence of a .ZIP file in a extern server (using ftp). if there are .ZIP files, the idea is what the script "unzip" them in the specified folder. THE PROBLEM IS what the script doen´t unzip the .ZIP files, and besides, delete... (1 Reply)
Discussion started by: DebianJ
1 Replies

2. UNIX for Dummies Questions & Answers

zip and email a file

I am trying to zip and email a .csv file from my unix box to myself and I get corrupt file. I have used the gzip to zip the file and I am using Winzip to try to unzip it. I'm not sure what I am doing wrong. Should I be using the zip command? (4 Replies)
Discussion started by: spalmarez
4 Replies

3. UNIX for Dummies Questions & Answers

How to use "mail" to attach a file with an email?

echo "content" | mail email@address -s subject Where to attach a file with the email? (2 Replies)
Discussion started by: meili100
2 Replies

4. Shell Programming and Scripting

attach multiple file in an email

Hello I have to attach multiple file as an email attachment. here is what i my understanding so far: 1. search in a certain directory that is there any specific file say for example .xml file exist or not 2. if exist then take those file name from the folder and attach it to another text... (1 Reply)
Discussion started by: osrukarigor
1 Replies

5. UNIX for Dummies Questions & Answers

How to attach a file in a email

Anyone can help me, in Unix, how can I attach a file in the email? Thank (3 Replies)
Discussion started by: ting123
3 Replies

6. Shell Programming and Scripting

Attach a binary file to email in a script

Hi, I am trying to get an email sent out by the unix ( aix ) system that has a .gz file attached to it. I can get the attachment, but it's not working when being looked at from outlook. I think there is a problem because of the way I am doing it, and the fact that it's binary. I am trying to... (15 Replies)
Discussion started by: fwellers
15 Replies

7. UNIX for Advanced & Expert Users

Zip an excel file and email using script.

Hi All, Currently i am using below script to attach excel and email from a Unix script. uuencode ASC.xls|mailx -m -s "ABCD_subject`TZ=CST+24 date +%d-%b-%y`" email@email.com Can anyone give me or help me in zipping excel and sending that email as the excel is very heavy. Thanks, (14 Replies)
Discussion started by: Nithin
14 Replies

8. Shell Programming and Scripting

How to split a csv file and zip it and attach using mutt command?

We need to redirect the output of a query to .csv file each containing a specified number of lines.Then we should zip these files and send as attachment using mutt command. We tried using split -l 500 query_output.txt outputfile Since we are not sure about the exact number of files... (0 Replies)
Discussion started by: Jassz
0 Replies

9. Shell Programming and Scripting

need to zip 2 GB file and send it via email

i want to zip the 2GB file and send it via email from unix machine using uuencode. could you please suggest whether it will possible or not and also command to do it. (3 Replies)
Discussion started by: mail2sant
3 Replies

10. Shell Programming and Scripting

Unable to attach a .txt file or .log file to mail and mailx command

Hi, I am trying to attach a .log file or .txt file to mail command to send an email once my ksh script executed. I am unable to use mutt command as it has been not installed and i am not supposed to install it. I have tried many ways by googling which has not helped me to succeed. Here is my... (5 Replies)
Discussion started by: Samah
5 Replies
elf_error(3E)															     elf_error(3E)

NAME
elf_errmsg, elf_errno - error handling SYNOPSIS
[flag... ] file... [library] ... DESCRIPTION
If an ELF library function fails, a program may call to retrieve the library's internal error number. As a side effect, this function resets the internal error number to zero, which indicates no error. takes an error number, err, and returns a null-terminated error message (with no trailing new-line) that describes the problem. A zero err retrieves a message for the most recent error. If no error has occurred, the return value is a null pointer (not a pointer to the null string). Using err of -1 also retrieves the most recent error, except it guarantees a non-null return value, even when no error has occurred. If no message is available for the given number, returns a pointer to an appropriate message. This function does not have the side effect of clearing the internal error number. EXAMPLES
The following fragment clears the internal error number and checks it later for errors. Unless an error occurs after the first call to the next call will return zero. (void)elf_errno(); while (more_to_do) { /* processing ... */ if ((err = elf_errno()) != 0) { msg = elf_errmsg(err); /* print msg */ } } SEE ALSO
elf(3E), elf_version(3E). elf_error(3E)
All times are GMT -4. The time now is 10:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy