Any unix/linux sysadmins fancy sharing/writing some .sh scripts???

Associate
Joined
28 Jul 2004
Posts
553
Hi,

Basically we have a number of servers here running HP-UX, RedHat 2, 3, and 4... and I want to get some basic scripts running on them to perform some basic System Admin tasks. I was thinking that I would crontab the scripts and get them to email the results daily. Is this a reasonable idea?

The kind of .sh scripts I was thinking about are...

* show the available disk space on the server (using bdf or df -k), and send an email if the disk space is more than say 90% full on any drive.
* show which users have been logging into the servers... usernames they used, time/date, their IP's, etc.
* tail the syslog etc and send any errors.

I know this is not a very specific list, but i figured that some of you would have some ready made scripts that we can adapt etc.

I am interested in ANY scripts that you find useful for your sysadmin tasks in unix/linux.

Plus any sites that you know of that has such scripts would be great?

Thanks.
 
feenster99 said:
Also interested in this - i'd like something to watch a particular folder, and drop me a daily email with the sizes of the sub folders within.

Matt :)

Well... I can do this one myself :)

How about...

#!/bin/sh
echo "Subject: dirsize email" > dirsize.tmp
du -ks $1 >> dirsize.tmp
du -ks $1/* >> dirsize.tmp
cat dirsize.tmp | mail $2
rm -f dirsize.tmp

Save it as a script called dirsize.sh and chmod u+x it. Then just stick it in your crontab or use it at command line like follows...

./dirsize.sh /home/blahsdir/ [email protected]

Cheers.
 
Back
Top Bottom