0

non-recursively find files older than 1 minute within my home directory and update their timestamp

* * * * * /usr/bin/find /home/me/ \( ! -name . -prune \) \( -type f -mmin +1 -name "*" \) -exec /usr/bin/touch {} \;

it runs like a charm from shell but not as a cronjob.

i've tried this modification:

* * * * * /usr/bin/find /home/me/ \( ! -name . -prune \) \( -type f -mmin +1 -name "*" \) -exec /usr/bin/touch {} \\;

and this one:

* * * * * /usr/bin/find /home/me/ \( ! -name . -prune \) \( -type f -mmin +1 -name "*" \) -exec /usr/bin/touch -- {} \;

still no joy.

avoiding a wrapper - a script to call this find command.

any ideas and pointers on how to make the cronjob work are appreciated. thank you.

user2585000
  • 113
  • 1
  • 9

1 Answers1

1

You should be getting mail messages with errors. I got this:

sh: 0403-057 Syntax error at line 1 : `(' is not expected.

So I doubled the \ to \\. That might be working. I'm not clear what the find command is suppose to be doing.

To debug this, I would prefix the command with a simple "echo" and then capture the output to a file. Indeed, during debugging, I would add a -print and capture it to a file as well as stderr to a separate file until it was working.

pedz
  • 2,271
  • 1
  • 17
  • 20