| | |
script for fedora core 4
Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
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
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/ FedoraOr 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
![]() |
Similar Threads
- Errors with smtp-vilter, ClamAv, and SpamAssassin on Fedora Core 2 (*nix Software)
- setup modem on fedora core (*nix Software)
- Dual booting windows xp and fedora core 1 using grub (*nix Software)
- setup dual boot xp and fedora core 1 (*nix Software)
- problem when installing fedora core 2 (*nix Software)
- fedora core 1 hang on install (*nix Software)
- anyone know when fedora core 2 is out (Getting Started and Choosing a Distro)
Other Threads in the Shell Scripting Forum
- Previous Thread: help: use of 'cmdtool'
- Next Thread: Need help with printing arrary in Ksh
| Thread Tools | Search this Thread |





