Re: stupid shell tricks again

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: plug-discuss
Subject: Re: stupid shell tricks again
On Mon, 2004-03-22 at 17:45, Bill Jonas wrote:
> On Mon, Mar 22, 2004 at 05:29:35PM -0700, Craig White wrote:
> > I will be dammed but I can't make the line above this one work...this is
> > where the problem is...
> > i=`echo $line | cut -f1`;
>
> Try:
> i=`echo $line | cut -d' ' -f1`;
> instead.

----
Just to share, I think I've got it - along with just a little more
knowledge about shell scripts (not much to show for 4.5 hours)...

#!/bin/sh
chdirect=/home/filesystems/samba/profiles
size_plateau=1536000
du -s $chdirect/* | while read line ; do
i=`echo $line|cut -d' ' -f1` ;
u=`echo $line | cut -d' ' -f2 | xargs -n 1 basename`
if [ $i -gt $size_plateau ]; then
s=`echo $((i / 1024)) Mb where 2000 Mb is the maximum space allowed.`
echo "Your Profile is getting too large. You probably need to clean up
your email or move some of your files in your My Documents folder. The
total size of your profile including email, My Documents, etc. is $s" |
mail $u -s "You need to pay attention to your profile"
fi
done

Thanks to Bill, Jeremy, Rowan and everyone else who is going to read
through this nonsense and wonder why the bother. I have created a small
number of shell scripts for server administration and would be happy to
share them - this is valuable stuff.

Craig

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss