On Tue, 8 Jul 2003, John Chambers wrote:
> | Why don't you use a cron job for that?
>
> Because it doesn't always work.
Then what about this:
#!/bin/sh
# Will run once an hour and remove
# all the temporary files older than
# an hour in a given directory.
# Provided "as-is" by Irwin Oppenheim.
DIR=/home/jc/abc # the directory with temp files
while :
do
touch $DIR/reference # store the current time
sleep 3600 # be quiet for one hour
for file in $DIR/*.tmp
do
if [ $file -ot $DIR/reference ]
then
rm -f $file
fi
done
done
# end of script
Who needs cron :-)
Just run it in the background, but make sure that you
own the directory $DIR and that the sticky bit has not
been set; otherwise the script might not be able to
delete the files. Of course the webserver must be able
to write in the directory in the first place.
Groeten,
Irwin Oppenheim
[EMAIL PROTECTED]
~~~*
Chazzanut Online:
http://www.joods.nl/~chazzanut/
To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html