944,148 Members | Top Members by Rank

Ad:
Aug 11th, 2005
0

script for fedora core 4

Expand Post »
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

thanks
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
jindalarpan is offline Offline
91 posts
since Aug 2005
Aug 11th, 2005
0

Re: script for fedora core 4

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,
Cain
Reputation Points: 18
Solved Threads: 2
Posting Whiz in Training
Cain is offline Offline
298 posts
since Aug 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: help: use of 'cmdtool'
Next Thread in Shell Scripting Forum Timeline: Need help with printing arrary in Ksh





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC