There's a discussion going on over on the MVS-OE forum (which I started) about
the /tmp subdirectory. It's gone away from my original towards how to keep it
clean. So I thought I'd ask the UNIX wizards over here what the "industry
standard" is. One thing mentioned by a person boiled down to "delete all the
files in /tmp which belong to a specific user when the last process which is
running with that UID terminates" (rephrased by me). This got me to thinking.
Is there any need for a file in /tmp to exist when there is no process running
by a given user? IOW, can some process be dependant on a file in /tmp which is
owned by a UID other than its own UID (and/or maybe 0). Or rephrasing again. If
I have a cron entry remove all the files in /tmp which are owned by a given UID
(not 0) when there are no processes running with that UID, could this cause a
problem? If you prefer an example, what if I run the following script daily by
root:
find /tmp -type f -exec ls -ln {} \; |\
awk '{print $3;}'|\
sort -u|\
while read XUID; do
echo Processing UID: $XUID;
ps -u $XUID -U $XUID >/dev/null || find /tmp -type f -uid $XUID -exec rm;
done
Perhaps I should do an "lsof" to see if the file is "in use" before doing the
"rm" on it? And the script needs to be made more efficient. I don't like doing
two find commands.
--
John McKown
Systems Engineer IV
IT
Administrative Services Group
HealthMarkets(r)
9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone *
[email protected] * www.HealthMarkets.com
Confidentiality Notice: This e-mail message may contain confidential or
proprietary information. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original message.
HealthMarkets(r) is the brand name for products underwritten and issued by the
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The
MEGA Life and Health Insurance Company.SM
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/