eshapley
asked on
Unix script command Find -exec | mailx
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 ";"
find /fdmdev/proedi/temp -name 'PROEDI*.CHK' -amin +60 -exec echo "Found" {} | mailx -s "Error" -c shapley ";"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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!
Sorry, the last part should read "-c alone is not a valid flag for IBM's mailx"
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
Better to use mmin
ASKER