-
Notifications
You must be signed in to change notification settings - Fork 807
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
## clean_haraka_logs 2016-09-02 | ||
## http://www.aqzt.com | ||
## email: [email protected] | ||
## robert yu | ||
## ubuntu | ||
|
||
#!/bin/bash | ||
date=`date -d "-1 day" +%Y%m%d` | ||
mkdir /data/haraka/$date/ | ||
mv /var/log/haraka.log /data/haraka/$date/haraka.log.$date | ||
/etc/init.d/haraka restart | ||
find /data/haraka/ -name "20*" -type d -mtime +3|tee -a /home/haraka_del.txt|xargs rm -r 2>>/home/haraka_err.txt | ||
echo ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
## clean_logs 2016-09-02 | ||
## http://www.aqzt.com | ||
## email: [email protected] | ||
## robert yu | ||
## centos 6 | ||
|
||
rm -rf /var/log/audit/audit.* | ||
rm -rf /var/log/secure-* | ||
rm -rf /var/log/messages-* | ||
rm -rf /var/log/spooler-* | ||
rm -rf /var/log/yum.log-* | ||
rm -rf /var/log/maillog-* | ||
rm -rf /var/log/cron-* | ||
rm -rf /var/log/btmp-* | ||
rm -rf /var/log/dracut.log-* | ||
rm -rf /var/log/dmesg.old | ||
|
||
cat /dev/null > /root/.bash_history | ||
cat /dev/null > /var/log/anaconda.syslog | ||
cat /dev/null > /var/log/anaconda.xlog | ||
cat /dev/null > /var/log/dmesg | ||
cat /dev/null > /var/log/lastlog | ||
cat /dev/null > /var/log/syslog | ||
cat /dev/null > /var/log/wtmp | ||
cat /dev/null > /var/log/btmp | ||
cat /dev/null > /var/log/maillog | ||
cat /dev/null > /var/log/messages | ||
cat /dev/null > /var/log/maillog | ||
cat /dev/null > /var/log/secure | ||
cat /dev/null > /var/log/cron | ||
history -c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
## clean_logs 2016-09-02 | ||
## http://www.aqzt.com | ||
## email: [email protected] | ||
## robert yu | ||
## ubuntu | ||
|
||
rm -rf /var/log/alternatives.log.* | ||
rm -rf /var/log/auth.log.* | ||
rm -rf /var/log/dmesg.* | ||
rm -rf /var/log/dpkg.log.* | ||
rm -rf /var/log/kern.log.* | ||
rm -rf /var/log/syslog.* | ||
rm -rf /var/log/ufw.log.* | ||
rm -rf /var/log/wtmp.* | ||
rm -rf /var/log/upstart/*.gz | ||
rm -rf /var/log/upstart/*.log | ||
cat /dev/null > /root/.bash_history | ||
cat /dev/null > /var/log/dmesg | ||
cat /dev/null > /var/log/lastlog | ||
cat /dev/null > /var/log/syslog | ||
cat /dev/null > /var/log/wtmp | ||
cat /dev/null > /var/log/mail.log | ||
cat /dev/null > /var/log/faillog | ||
cat /dev/null > /var/log/udev | ||
history -c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
disk_info () | ||
{ | ||
echo "======================disk info========================" | ||
df -ThP|column -t | ||
} | ||
|
||
cpu_info () | ||
{ | ||
echo "=======================cpu info========================" | ||
echo "cpu processor is $(grep "processor" /proc/cpuinfo |wc -l)" | ||
echo "cpu mode name is $(grep "model name" /proc/cpuinfo |uniq|awk '{print $4,$5,$6,$7,$8,$9}')" | ||
grep "cpu MHz" /proc/cpuinfo |uniq |awk '{print $1,$2":"$4}' | ||
awk '/cache size/ {print $1,$2":"$4$5}' /proc/cpuinfo |uniq | ||
} | ||
|
||
mem_info () | ||
{ | ||
echo "=====================memory info========================" | ||
MemTotal=$(awk '/MemTotal/ {print $2}' /proc/meminfo) | ||
MemFree=$(awk '/MemFree/ {print $2}' /proc/meminfo) | ||
Buffers=$(awk '/^Buffers:/ {print $2}' /proc/meminfo) | ||
Cached=$(awk '/^Cached:/ {print $2}' /proc/meminfo) | ||
FreeMem=$(($MemFree/1024+$Buffers/1024+$Cached/1024)) | ||
UsedMem=$(($MemTotal/1024-$FreeMem)) | ||
echo "Total memory is $(($MemTotal/1024)) MB" | ||
echo "Free memory is ${FreeMem} MB" | ||
echo "Used memory is ${UsedMem} MB" | ||
} | ||
|
||
load_info () | ||
{ | ||
echo "=====================load info==========================" | ||
Load1=$(awk '{print $1}' /proc/loadavg) | ||
Load5=$(awk '{print $2}' /proc/loadavg) | ||
Load10=$(awk '{print $3}' /proc/loadavg) | ||
echo "Load in 1 min is $Load1" | ||
echo "Load in 5 min is $Load5" | ||
echo "Load in 10 min is $Load10" | ||
} | ||
|
||
network_info () | ||
{ | ||
echo "=====================network info=======================" | ||
network=$(ifconfig |grep "inet addr" |grep -v "127.0.0.1" |awk '{print $2}'|sed "s/addr://g") | ||
echo "network eth0 IP is $network" | ||
} | ||
|
||
network_card_info () | ||
{ | ||
echo "=====================network_card_info===================" | ||
card=$(ip a|awk -F "inet|/" '/inet.*brd/ {print $2}') | ||
echo "Network card is $card" | ||
} | ||
|
||
|
||
|
||
disk_info | ||
cpu_info | ||
mem_info | ||
load_info | ||
network_info | ||
network_card_info |