I am trying write a script to delete old log files in \var\log\applog\nmon
on my AIX system. We usually get alerts that the file system is almost full and at the moment delete old files by hand. So basically what i am looking for is a script that I can schedule in a cron
job . This script should keep logs for two months and delete the rest.
There are two files I don't want to be deleted: .profile
and .sh_history
.
I tried this command:
find nmon -mtime +60 -type f -not -name ".profile" -not -name ".sh_history" –delete
It works fine but it also deletes those two file which I mentioned earlier .
I am not sure how to proceed with the script so that i can delete old logs file but not those two files.
I tried above command but it gave me this error:
find: 0652-017 -not is not a valid option.