Operating System - HP-UX
1837939 Members
2726 Online
110124 Solutions
New Discussion

Script to cleanup make_net_recovery archives and dir /var/opt/ignite/clients....

 

Script to cleanup make_net_recovery archives and dir /var/opt/ignite/clients....

Does anyone have a script(korn shell/bourne shell) that cleansup make_net_recovery archives and also corresponding files/directory in /var/opt/ignite/clients//recovery on an Ignite server that are older than say for e.g. 60 days.
Hello
7 REPLIES 7
Sridhar Bhaskarla
Honored Contributor

Re: Script to cleanup make_net_recovery archives and dir /var/opt/ignite/clients....

Hi,

I would let make_net_recovery handle it than writing my own script. By default, make_net_recovery will keep two archives. Next time it will remove the oldest archive after creating the archive.

You can write a script using find and mtime. But if you don't create any archive in 120days, you will not have any archives for that client left on the ignite server. So I lean towards letting make_net_recovery handle it.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try

Re: Script to cleanup make_net_recovery archives and dir /var/opt/ignite/clients....

Sri,

In my work place we run make_net_recovery every month on a client system so removing older ones is not a problem.We want to have make_net_recovery itself do the cleanup when it runs the 3rd time on a client but sometimes we rebuild a server,decommission a server and a make_net_recovery has n't been done for some months in which case there are archives for that client that are sitting out there for several days consuming disk space.It would be more appropriate if we removed the older ones.I am writing a script using find like
find $Archives_Dir -type f -mtime +60 -exec rm {} \;
find /var/opt/ignite/clients/*/recovery -type f -mtime +60 -exec rm {} \;
When I use ll instead of rm in -exec option I see the files in sub-directories below /var/opt/ignite/clients/*/recovery being selected for removal which is what I expected but it does n't list out the sub-directory itself for removal even If I try it with type d or without a type option at all.Can you throw some light on this piece of the script.
Hello
Sridhar Bhaskarla
Honored Contributor

Re: Script to cleanup make_net_recovery archives and dir /var/opt/ignite/clients....

Hi,

I would write like this

find $DIR -mtime +60 |xargs rm -rf

If you are two particular, you can do

find $DIR \( -type f -o -type d \) -mtime +60 |xargs rm -rf

-Sri
You may be disappointed if you fail, but you are doomed if you don't try

Re: Script to cleanup make_net_recovery archives and dir /var/opt/ignite/clients....

Thanks Sri for your answer.I tried find with rm -rf on some files/dirs in my home dir which works.I do know it will work when I do
find /var/opt/ignite/clients/*/recovery -type d -mtime +60 -exec rm -rf {} \;

but I do not want to use rm -rf.(rm or rmdir will be fine but not rm -rf).
Hello
Donny Jekels
Respected Contributor

Re: Script to cleanup make_net_recovery archives and dir /var/opt/ignite/clients....

You already have more than enough responses for cleaning old ignite archives.

here is two scripts I wrote to report on all my make_net_recovery archive.logs in the last 5 days.

update the script variables, chmod and run.

enjoy,
Donny
"Vision, is the art of seeing the invisible"
Donny Jekels
Respected Contributor

Re: Script to cleanup make_net_recovery archives and dir /var/opt/ignite/clients....

sorry, forgot the attach the scripts.

and this forum only accept one attachment per submission.

here is the perl script that sends the report in html format.
"Vision, is the art of seeing the invisible"
Donny Jekels
Respected Contributor

Re: Script to cleanup make_net_recovery archives and dir /var/opt/ignite/clients....

and now for the main engine.
"Vision, is the art of seeing the invisible"