Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
new to scripting pls help
Name: anthonyr Date: February 13, 2006 at 16:33:13 Pacific OS: solaris 9 CPU/Ram: 2GB Product: V210
Comment:
Hi i am having this problem with one of my solaris machines. the /var slice is filling up and if i don't check on a regular basis i might miss something. So what i have done set a cron job to email me everyday the df -k,which work ok, but what i am trying to do is to email if the /var slice gets over 90% capacity. I am new to solaris and scripting, can anybody help me out there cheers
Name: David Perry Date: February 16, 2006 at 08:43:06 Pacific
Reply:
#!/bin/ksh MAILTO="user@host.com" echo "df -k output for `date` `uname -a`" > /tmp/df.out case `uname -s` in SunOS | Linux | OSF1 | UNIX_SV | FreeBSD ) if [ -s "/etc/redhat-release" ] ; then cat /etc/redhat-release >> /tmp/df.out ; fi set -- `df -k | sed -e 's/%//g' | awk '/^\/dev/ { printf("%s %s\n", $5, $6) }'` ;; HP-UX ) set -- `bdf | sed -e 's/%//g' | awk '/^\/dev/ { printf("%s %s\n", $5, $6) }'` AIX ) set -- `df -k | sed -e 's/%//g' | awk '/^\/dev/ { printf("%s %s\n", $4, $7) }'` ;; esac
while [ $# -ge 2 ] ; do CAPACITY=$1 FS=$2 shift 2
if [ $CAPACITY -gt 90 ] ; then echo "$FS is at $CAPACITY %" >> /tmp/df.out fi done if [ `wc -l /tmp/df.out | awk '{ print $1 }'` -ge 2 ] ; then cat /tmp/df.out | mail -s "`date`" $MAILTO fi
0
Response Number 2
Name: anthonyr Date: February 20, 2006 at 18:24:54 Pacific
Reply:
thank you very much for your help. Worked like a charm....
Summary: Hi All, Can anyone please help with the following, I'm trying to write a script(bash) that will: 1. constantly run in the background and monitor the size of a particular file. 2. When this file reach...
Summary: Hi! I am having a similar problem, and am also new to the world of Unix/Solaris. I am running Solaris 8 on the Intel platform. Using the ifconfig iprb0 command I was able to determine that the mach...
Summary: I am new to scripting. I would like to track the number of users logged into my system automatically every hourly. Currently I am issuing the commands manually as follows: ps -eaf|grep explorer>out.t...