Solved

Unix script command Find -exec | mailx

Posted on 2010-08-31
5
880 Views
Last Modified: 2013-11-17
I want to send an email message to a user or distribution list (already created) if the file is older than sixty minutes.  Here is the command I am using.  I get an error "expression term lacks a required parameter.  I would like to get this command working, but will welcome other suggestions for tackling the same requirement.

find /fdmdev/proedi/temp -name 'PROEDI*.CHK' -amin +60 -exec echo "Found" {} | mailx -s "Error" -c shapley ";"
0
Comment
Question by:eshapley
  • 3
5 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 33570131
Hi,

the error message is due to the missing semicolon following the "exec" construct. The statements following the pip" are not part of exec!
So it should be like this:

find /fdmdev/proedi/temp -name 'PROEDI*.CHK' -amin +60 -exec echo "Found" {} ";" | mailx -s "Error" -c shapley

wmp

0
 

Author Closing Comment

by:eshapley
ID: 33570224
Thank you !!
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 33570227
Just saw it - could it be that your mailx statement is missing a recipient? And if it's really AIX - "-c" is not a valid flag for IBM's mailx!
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 33570267
Sorry, the last part should read "-c alone is not a valid flag for IBM's mailx"
0
 
LVL 48

Expert Comment

by:Tintin
ID: 33575732
Note that amin +60 (or atime) won't necessarily tell you if a file is older than 60 minutes, because if you view the file, the atime will be reset.

Better to use mmin
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix Question 19 50
Need a version of telnet and/or ssh that supports tcp wrappers on AIX 5.1 16 86
Bash Script to Analyze Oracle Schemas 11 104
Details to create developer account 10 38
Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question