Some help with a find/fuser/gzip crontab job

Hello,

I am trying to write a housekeeping that finds all .trc files older than x days in a given FS, checks if they are used and gzips them if they are not used by any process. I need to do it without calling any additional .sh script.

I managed to make it work for Linux only:

find . -xdev -name "*.trc" -type f -mtime +5  -and -not -exec fuser -s {} ';' -and -exec gzip -9f {} ';'

Please advise how can I make it work on UNIX too. The '-and -not' options are not available there.

Any help would be highly appreciated.

There are many UNIXes... depending what you mean with "UNIX", they are usually there. If you would check the man page for find, you might find -a and -o instead.

Sorry, I forgot to mention it's HP UX

Ok, did you check the man page for the switches I mentioned? Did it help?

I tried it with -a -o but it gzipped everything, not only .trc files:

find . -xdev -name "*.trm" -type f -mtime +5 -a -exec !fuser -s {} ';' -o -exec gzip -9f {} ';'

I am doing something wrong but I am not sure where in the syntax