×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Question about command difference crontab vs command line with find and exec rm
2

Question about command difference crontab vs command line with find and exec rm

Question about command difference crontab vs command line with find and exec rm

(OP)
Hi all

I just checked previousl posts, but not find what I am looking for.
I have a command running on AIX 6.1 TL6 to delete NMON Files older than 7 days

/usr/bin/find /var/adm/nmon_data -mtime +7 -exec rm {} \;

If I fire this command on command line it works fine, to be sure I tried ksh, sh (which is default for root) and bash,
but I want to run this with crontab
47 16 * * 4 /usr/bin/find /var/adm/nmon_data/ -mtime +7 -exec rm {} \;

It wil not work and sends a mail for root with :

Your "cron" job executed on xxxxx on Thu Jan 9 16:47:00 CET 2014
/usr/bin/find /var/adm/nmon_data -mtime +7 -exec rm {} ;


produced the following output:

find: 0652-018 An expression term lacks a required parameter.


What I need to set up ? On Solaris this works fine

regards
appi

RE: Question about command difference crontab vs command line with find and exec rm

(OP)
Thanks Frederico

this works now on AIX 6.1. But I do not understand why .... On Solaris Double Backslash give an error.

regards
appi

RE: Question about command difference crontab vs command line with find and exec rm

Hi,

It's because \ is an escape character, so to actually pass \, you need to escape it first.

Not sure I can explain it any better.

Thanks

-----
Cheers,
Henrik Morsing
http://www.aixperts.co.uk/
http://www.seaholme.co.uk/
Join us on irc://chat.freenode.net channel ##aix

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close