LVM and VxVM

clean_tmps for /tmp and /var/tmp

 
Christina Martin
Frequent Advisor

clean_tmps for /tmp and /var/tmp

we have our system configured to clean these directories.

because of security restrictions we've had to set the sticky bit on these directories.

clean_tmps will NOT delete the files in /tmp or /var/tmp and we believe it's because of the sticky bit.

anyone run into this before? what was your solution?
12 REPLIES 12
Hasan  Atasoy
Honored Contributor

Re: clean_tmps for /tmp and /var/tmp

hi cristiana;

did you change default value in /etc/rc.config.d/clean_tmps
CLEAR_TMP=1

?

HAsan
Christina Martin
Frequent Advisor

Re: clean_tmps for /tmp and /var/tmp

yes. that definition has been set as well.

We just removed the sticky bit from /var/tmp, ran clean_tmps and it still didn't clear /var/tmp.

SO, back to the drawing board...
Lisa
Hasan  Atasoy
Honored Contributor

Re: clean_tmps for /tmp and /var/tmp

hi crstiana,

if you look at clean_tmps script it does not clean /var/tmp directoy . it just clean /tmp and list files in /var/tmp

Hasan
James R. Ferguson
Acclaimed Contributor

Re: clean_tmps for /tmp and /var/tmp

Hi Christina:

It is always helpful when diagnosing startup script problems to examine the '/etc/rc.log'.

Since startup scripts run as root, setting the sticky bit to restrict file removal to the file's owner is immaterial in this case.

Regards!

...JRF...
VK2COT
Honored Contributor

Re: clean_tmps for /tmp and /var/tmp

Hello,

You obviously run HP-UX 11.1 or 11.23.
They are not designed to automate
cleanup of /var/tmp at boot time.
/etc/rc.config.d/clean_tmps was
only meant for cleaning up /tmp.

However, you could modify /sbin/init.d/clean_tmps and
replace the following lines:

orig_dir="/" # we start out at '/' (root)
cd /tmp
if [ $? -ne 0 ]; then
echo "ERROR: could not change to directory "
echo "ERROR: no cleaning done"
rval=1
else
echo "NOTE: Clearing files from /tmp"
# ll |grep "^d.*"|awk '{print $9}'|grep -v "lost+found"|xargs rm -rf
#
# fix for DSDe443580: Begin :
# /sbin/init.d/clean_tmps script fails with large numbers of files in the
# /tmp directory.
# rm command was failing because the argument list was greater than ARG_MAX.
# xargs(1) is used to limit the argument size of rm to ARG_MAX.
#
# Fix for Defect JAGab68614 : Bad Patch PHCO_15932
# clean_tmps script will fail if the /tmp directory contains -name file types.
# "rm -rf" is changed to "rm -rf --"
ls | grep -v "lost+found" | xargs rm -rf --
rm lost+found 2>/dev/null
# DSDe443580 : End :
fi
cd $orig_dir

with something like:

orig_dir="/" # we start out at '/' (root)
for cldir in "/tmp /var/tmp"
do
cd /$cldir
if [ $? -ne 0 ]; then
echo "ERROR: could not change to directory <$cldir>"
echo "ERROR: no cleaning done"
rval=1
else
echo "NOTE: Clearing files from $cldir"
# ll |grep "^d.*"|awk '{print $9}'|grep -v "lost+found"|xargs rm -rf
#
# fix for DSDe443580: Begin :
# /sbin/init.d/clean_tmps script fails with large numbers of files in the
# /tmp directory.
# rm command was failing because the argument list was greater than ARG_MAX.
# xargs(1) is used to limit the argument size of rm to ARG_MAX.
#
# Fix for Defect JAGab68614 : Bad Patch PHCO_15932
# clean_tmps script will fail if the /tmp directory contains -name file types.
# "rm -rf" is changed to "rm -rf --"
ls | grep -v "lost+found" | xargs rm -rf --
rm lost+found 2>/dev/null
# DSDe443580 : End :
fi
cd $orig_dir
done

Note that each patch upgrade will possibly
overwrite /sbin/init.d/clean_tmps so
you need to save the customized copy of
the file...

Cheers,

Dusan
VK2COT - Dusan Baljevic
VK2COT
Honored Contributor

Re: clean_tmps for /tmp and /var/tmp

Hello,

They are not designed to automate
cleanup of /var/tmp at boot time.
/etc/rc.config.d/clean_tmps was
only meant for cleaning up /tmp.

However, you could modify /sbin/init.d/clean_tmps and
replace the following lines:

orig_dir="/" # we start out at '/' (root)
cd /tmp
if [ $? -ne 0 ]; then
echo "ERROR: could not change to directory "
echo "ERROR: no cleaning done"
rval=1
else
echo "NOTE: Clearing files from /tmp"
# ll |grep "^d.*"|awk '{print $9}'|grep -v "lost+found"|xargs rm -rf
#
# fix for DSDe443580: Begin :
# /sbin/init.d/clean_tmps script fails with large numbers of files in the
# /tmp directory.
# rm command was failing because the argument list was greater than ARG_MAX.
# xargs(1) is used to limit the argument size of rm to ARG_MAX.
#
# Fix for Defect JAGab68614 : Bad Patch PHCO_15932
# clean_tmps script will fail if the /tmp directory contains -name file types.
# "rm -rf" is changed to "rm -rf --"
ls | grep -v "lost+found" | xargs rm -rf --
rm lost+found 2>/dev/null
# DSDe443580 : End :
fi
cd $orig_dir

with something like:

orig_dir="/" # we start out at '/' (root)
for cldir in "/tmp /var/tmp"
do
cd /$cldir
if [ $? -ne 0 ]; then
echo "ERROR: could not change to directory <$cldir>"
echo "ERROR: no cleaning done"
rval=1
else
echo "NOTE: Clearing files from $cldir"
# ll |grep "^d.*"|awk '{print $9}'|grep -v "lost+found"|xargs rm -rf
#
# fix for DSDe443580: Begin :
# /sbin/init.d/clean_tmps script fails with large numbers of files in the
# /tmp directory.
# rm command was failing because the argument list was greater than ARG_MAX.
# xargs(1) is used to limit the argument size of rm to ARG_MAX.
#
# Fix for Defect JAGab68614 : Bad Patch PHCO_15932
# clean_tmps script will fail if the /tmp directory contains -name file types.
# "rm -rf" is changed to "rm -rf --"
ls | grep -v "lost+found" | xargs rm -rf --
rm lost+found 2>/dev/null
# DSDe443580 : End :
fi
cd $orig_dir
done

Note that each patch upgrade will possibly
overwrite /sbin/init.d/clean_tmps so
you need to save the customized copy of
the file...

Cheers,

Dusan
VK2COT - Dusan Baljevic
VK2COT
Honored Contributor

Re: clean_tmps for /tmp and /var/tmp

Hello,

They are not designed to automate
cleanup of /var/tmp at boot time.
/etc/rc.config.d/clean_tmps was
only meant for cleaning up /tmp.

However, you could modify /sbin/init.d/clean_tmps and
replace the following lines:

orig_dir="/" # we start out at '/' (root)
cd /tmp
if [ $? -ne 0 ]; then
echo "ERROR: could not change to directory "
echo "ERROR: no cleaning done"
rval=1
else
echo "NOTE: Clearing files from /tmp"
# ll |grep "^d.*"|awk '{print $9}'|grep -v "lost+found"|xargs rm -rf
#
# fix for DSDe443580: Begin :
# /sbin/init.d/clean_tmps script fails with large numbers of files in the
# /tmp directory.
# rm command was failing because the argument list was greater than ARG_MAX.
# xargs(1) is used to limit the argument size of rm to ARG_MAX.
#
# Fix for Defect JAGab68614 : Bad Patch PHCO_15932
# clean_tmps script will fail if the /tmp directory contains -name file types.
# "rm -rf" is changed to "rm -rf --"
ls | grep -v "lost+found" | xargs rm -rf --
rm lost+found 2>/dev/null
# DSDe443580 : End :
fi
cd $orig_dir

with something like:

orig_dir="/" # we start out at '/' (root)
for cldir in "/tmp /var/tmp"
do
cd /$cldir
if [ $? -ne 0 ]; then
echo "ERROR: could not change to directory <$cldir>"
echo "ERROR: no cleaning done"
rval=1
else
echo "NOTE: Clearing files from $cldir"
# ll |grep "^d.*"|awk '{print $9}'|grep -v "lost+found"|xargs rm -rf
#
# fix for DSDe443580: Begin :
# /sbin/init.d/clean_tmps script fails with large numbers of files in the
# /tmp directory.
# rm command was failing because the argument list was greater than ARG_MAX.
# xargs(1) is used to limit the argument size of rm to ARG_MAX.
#
# Fix for Defect JAGab68614 : Bad Patch PHCO_15932
# clean_tmps script will fail if the /tmp directory contains -name file types.
# "rm -rf" is changed to "rm -rf --"
ls | grep -v "lost+found" | xargs rm -rf --
rm lost+found 2>/dev/null
# DSDe443580 : End :
fi
cd $orig_dir
done

Note that each patch upgrade will possibly
overwrite /sbin/init.d/clean_tmps so
you need to save the customized copy of
the file...

Cheers,

Dusan
VK2COT - Dusan Baljevic
Christina Martin
Frequent Advisor

Re: clean_tmps for /tmp and /var/tmp

response to:
Feb 10, 2008 20:17:38 GMT points for answer: Unassigned 10 9 8 7 6 5 4 3 2 1 0

--------------------------------------------------------------------------------
hi crstiana,

if you look at clean_tmps script it does not clean /var/tmp directoy . it just clean /tmp and list files in /var/tmp

Hasan




yes, it lists the files in /var/tmp. However it doesn't clean it.

cleaning of /tmp is pretty consistent, but doesn't always happen.
Christina Martin
Frequent Advisor

Re: clean_tmps for /tmp and /var/tmp

response to:

Hello,

You obviously run HP-UX 11.1 or 11.23.
They are not designed to automate
cleanup of /var/tmp at boot time.
/etc/rc.config.d/clean_tmps was
only meant for cleaning up /tmp.




Thank you,
we'll give this a shot today and see what happens... .

I'll get back to you in a couple hours!

Lisa