|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| 07/04/2009 at 11:11PM PDT, ID: 24544528 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: |
#!/bin/sh
#####Script to show status of daemons, interfaces and free disk space:
#########Apache status:
if [ -e /var/run/httpd.pid ]
then
echo "[1;34mWebserver Online[0m" > /etc/test.motd
else
echo "[31;47mWebserver Offline[0m" >> /etc/test.motd
fi
#########MySQL status:
if [ -e /var/run/mysqld/mysqld.pid ]
then
echo "[1;34mMySQL Database Online[0m" >> /etc/test.motd
else
echo "[31;47mMySQL Database Offline[0m" >> /etc/test.motd
fi
#########Sendmail status:
if [ -e /var/run/sendmail.pid ]
then
echo "[1;34mMailserver Online[0m" >> /etc/test.motd
else
echo "[31;47mMailserver Offline[0m" >> /etc/test.motd
fi
#########Fail2ban status:
if [ -e /var/run/fail2ban/fail2ban.pid ]
then
echo "[1;34mFail2ban Online[0m" >> /etc/test.motd
else
echo "[31;47mFail2ban Offline[0m" >> /etc/test.motd
fi
#########SSHd status:
SSHSTAT=`/etc/init.d/sshd status |grep 'is running'`
if [ "$SSHSTAT" = "is running" ]
then
echo "[1;34mSSH Online[0m" >> /etc/test.motd
else
echo "[31;47mSSH Offline[0m" >> /etc/test.motd
fi
#########Webmin status:
WEBMINSTAT=`/etc/init.d/webmin status |grep 'is running'`
if [ "$WEBMINSTAT" = "is running" ]
then
echo "[1;34mWebmin Online[0m" >> /etc/test.motd
else
echo "[31;47mWebmin Offline[0m" >> /etc/test.motd
fi
##########Zaptel Status:
if [ -e /proc/zaptel/ ]
then
echo "[1;34mZaptel Trunks Online[0m" >> /etc/test.motd
else
echo "[31;47mZaptel Trunks Offline[0m" >> /etc/test.motd
fi
#########Iptables status:
FIREWALLSTAT=`/etc/init.d/iptables status`
if [ "$FIREWALLSTAT" = "Firewall is stopped." ]
then
echo "[31;47mFirewall Offline[0m" >> /etc/test.motd
else
echo "[1;34mFirewall Online[0m" >> /etc/test.motd
fi
#########Eth0 status:
ETH0STAT=`ifconfig eth0 |grep UP | awk '{print $1}'`
if [ "$ETH0STAT" = UP ]
then
echo "[1;34mLAN ETH0 Online[0m" >> /etc/test.motd
else
echo "[31;47mLAN ETH0 Offline[0m" >> /etc/test.motd
fi
#########Eth1 status:
ETH1STAT="ifconfig eth1 |grep UP | awk '{print $1}'"
if [ "$ETH1STAT" = UP ]
then
echo "[1;34mLAN ETH1 Online[0m" >> /etc/test.motd
else
echo "[31;47mLAN ETH1 Offline[0m" >> /etc/test.motd
fi
#########Wlan0 status:
WLAN0STAT="ifconfig wlan0 |grep UP | awk '{print $1}'"
if [ "$WLAN0STAT" = UP ]
then
echo "[1;34mWireless Online[0m" >> /etc/test.motd
else
echo "[31;47mWireless Offline[0m" >> /etc/test.motd
fi
#########Show percent used on root file system:
EXCLUDE_PARTITIONS="/auto/ripper|/dev/hda1|/dev/sda1|none|/dev/md0|/dev/md1|tmpfs|cdrom|Filesystem"
ROOTUSED=`df -H | grep -vE "^$EXCLUDE_PARTITIONS" | awk '{print $5 " " }' | sed 's/%//'`
if [ $ROOTUSED -gt 80 ]
then
echo "DANGER Disk space used: [31;47$ROOTUSED%[0m" >> /etc/test.motd
else
echo "[1;34mDisk space used: $ROOTUSED%[0m" >> /etc/test.motd
fi
#########How many users are logged on:
echo "`who | wc -l` users are logged in" >> /etc/test.motd
|
Advertisement