[pca] /var/sadm/pkg

Jeff A. Earickson jaearick at colby.edu
Mon Jan 12 19:31:38 CET 2009


Teddy,

Attached is my script that I use to clean up old patches.  Take a look
and see if this helps.

Jeff Earickson
Colby College

On Mon, 12 Jan 2009, Teddy Rodriguez wrote:

> Date: Mon, 12 Jan 2009 12:37:02 -0500
> From: Teddy Rodriguez <trodrigu at ramapo.edu>
> Reply-To: "PCA (Patch Check Advanced) Discussion" <pca at lists.univie.ac.at>
> To: pca at lists.univie.ac.at
> Subject: [pca] /var/sadm/pkg
> 
> Hi All,
>
>
>
> My /var partition is almost full and I can see that most of it is taken up
> by the /var/sadm/pkg directory.  I know this is where Solaris stores backup
> of patches, in case you have to revert back, but after reading some forums
> I'm a little hesitant in deleting anything from there.  I think deleting the
> *obsolete* files inside that directory were the safest thing to remove, but
> I was wondering if anyone out there has deleted anything from this
> directory.
>
>
>
> Thanks for any input.
>
>
>
> Teddy Rodriguez
>
> Database and Systems Administrator
>
> Ramapo College of NJ
>
> 505 Ramapo Valley Rd
>
> Mahwah, NJ  07430
>
> Phone: (201) 684 - 6829
>
> Fax: (201) 684 - 7961
>
> Email:  <mailto:trodrigu at ramapo.edu> trodrigu at ramapo.edu
>
>
-------------- next part --------------
#!/usr/bin/ksh
#
#---clean up old OS patches for Solaris
#
DEBUG=0
FIND=/usr/local/bin/find

df -h /
#---zap obsolete backups
if [ $DEBUG -eq 1 ]; then
	print "=== obsolete patches === "
	$FIND /var/sadm/pkg -name 'obsolete.Z' -print
	$FIND /var/sadm/pkg -name 'obsolete' -print
else
	$FIND /var/sadm/pkg -name 'obsolete.Z' -print | xargs rm -f
	$FIND /var/sadm/pkg -name 'obsolete' -print | xargs rm -f
fi

#---zap undos older than 40 days
if [ $DEBUG -eq 1 ]; then
	print "=== undo patches === "
	$FIND /var/sadm/pkg -name 'undo.Z' -mtime +40 -print
	$FIND /var/sadm/pkg -name 'undo' -mtime +40 -print
else
	$FIND /var/sadm/pkg -name 'undo.Z' -mtime +40 -print | xargs rm -f
	$FIND /var/sadm/pkg -name 'undo' -mtime +40 -print | xargs rm -f
fi

#---cleanup up /var/sadm/spool
cd /var/sadm/spool
if [ $DEBUG -eq 1 ]; then
	ls -l *.jar
	ls -l *.jar.tmp
	ls -ld *.jar.dir 
else
	rm -f *.jar *.jar.tmp
	rm -rf *.jar.dir
fi

df -h /


More information about the pca mailing list