Hi, I am not really good at shell scripting. I usually cut and paste from other scripts and customize it to do what I need. I am running Oracle 10g on AIX 5.3 machine and I need a script that monitors a filesystem, I would say at least every hour by cron, and if the filesystem hits above 80% full then I want the script to start deleting the oldest files in the filesystem first until the filesystem is back down to 50% full.
I have scripts that monitor the filesystem, but the whole 80 to 50% thing is where I am stumped. I have this script which I use to check the FS size and then email me when it gets past a certain percentage, was hoping I could modify that one maybe:
The following would deal with the filesystem used thresholds:
Code:
FILESYSTEM=/path/subpath
if [ `df -k ${FILESYSTEM} | grep -v Use | awk '{ print $5 }' | sed 's/%//'` -gt 80 ]; then
while [ `df -k ${FILESYSTEM} | grep -v Use | awk '{ print $5 }' | sed 's/%//'` -gt 50 ]; do
# do your file deleting here
echo "FS is greater than 50% full."
done
else
echo "Filesystem not too full yet"
fi
This assumes the output from:
df -k /path/subpath
looks like:
Code:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda5 109530708 31173952 72792648 30% /path
I'll leave the dangerous deleting of the oldest files bit to someone else!
i booted into maintenance mode
boot -- -s
from the console
I got the
Root password for system maintenance (control-d to bypass)
I did control -d
and then logged in
it told me that I was booting into boot -s
but after I did a control -d and logged in
who -r shows
... (9 Replies)
Dear Unix gurus,
We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Dear Unix gurus,
We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist.
diff=$1$2.diff
id=$2 new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff | awk... (2 Replies)
Hi Guys
i wonder if anyone can help. i want to create a script that checks multiple servers for disk space availible, cpu usage for past 24 hours. as well as check if all the hardware components are still doing their jobs. i will be doing this in the tcsh, can anyone help? OS = Sun Solaris 5.10... (2 Replies)
i want use ssh on the host01 to execute autoexec.sh on the host02 like following :
host01> ssh host02 autoexec.sh
autoexec.sh include nohup command like follwing :
nohup /home/jack/deletedata.sh &
after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
How are libraries created and maintained? I tried the following to add prog.o to an existing library
ar -r library.so prog.o
but the output is "File format not recognized", on the other hand
nm --print-armap library.so
does print a table of contents. (2 Replies)
I gurus of Solaris,
I need to do a Procedure concerning in the Maintenance of Solaris Server.
What are the parameters that I must be see Periodically in a Server.
For example the space I (df -h) must be each week.- In this server exist a Database aplication (Oracle), and log's that increase or... (4 Replies)
Hi there,
It's my first time here. I have an hard drive need a maintenance.
here the result of metastat :
Sun Microsystems Inc. SunOS 5.9 Generic May 2002
host2{11}: metastat
d1: RAID
State: Needs Maintenance
Invoke: metareplace d1 c2t2d0s1 <new device>
Interlace:... (3 Replies)
How do I go about doing this??? Is there something to it other than cleaning up useless files?? if you have knowledge concerning this, please give your suggestions
also, is it possible or safe to compress an entire filesystem. how do you go about doing this??? any information is appreciated (7 Replies)