hey friends
i m facing one problem that on sever their is fedora core 4 and when ever temp(/tmp) is filled server go show.
can any one provide me with the script that can automatically cleans up /tmp after some days or when temp is going to fill


First I would investigate the source of the problem. /tmp could have been made too small when the install occured or you could have a log file that is just in the wrong spot. move the log file to /var/log if applicable. make changes where appropriate.

I usually put all of my root level scripts in roots home area in a directory called scripts.
e.g. /root/scripts/script.bash

You could use /etc/cron.daily/tmpwatch
This is easiest :) I know it ships with RHAS3/4 so ti should ship w/ Fedora

Or you could write a script if the culprit filename is the same every time
the simplest form of script is just an executable file that starts off with the first line as:

!#/bin/bash -f

followed by the command you want to execute:
# use # as comment character
# echo out and append the bad file info and disk usage to /var/log/messages formatted cute of course.. ;)

/bin/echo "--------------------------------------" >> /var/log/messages
/bin/echo "Cron is running /root/scripts/script.bash" >> /var/log/messages
/bin/echo "--------------------------------------" >> /var/log/messages
/bin/date >> /var/log/messages
# list the contents of the directory before deletion so we have a record
/bin/ls -ltR /tmp >> /var/log/messages
# check disk usage before
/bin/du -sk /tmp >> /var/log/messages
#lets remove the file by common name (if the same every time)
/bin/rm -f /tmp/culpritfile.log
echo "Removed /tmp/culpritfile.log" >> /var/log/messages
/bin/date >> /var/log/messages
/bin/echo "--------------------------------------" >> /var/log/messages

feel free to copy this into a text file and modify as needed. this is a simple script
the '>>'s say "redirect output and append it to the end of specified file"
modify as needed

set as a nightly cron job while root using crontab -e

if youre not sure how hit the man pages
man tmpwatch
man cron

..or google em.

good luck,

This question has already been answered. Start a new discussion instead.