sudo su -
cd /home
for username in `ls -1` 'root'
do
echo '############' $username '############' >> /tmp/crontab_`hostname`_old_$(date +%F).txt
id $username >> /tmp/crontab_`hostname`_old_$(date +%F).txt
echo 'Crontab for user: ' $username >> /tmp/crontab_`hostname`_old_$(date +%F).txt
su - $username -c 'crontab -l' >> /tmp/crontab_`hostname`_old_$(date +%F).txt
echo -e '\n\n\n' >> /tmp/crontab_`hostname`_old_$(date +%F).txt
done
cat /tmp/crontab_`hostname`_old_$(date +%F).txt
chmod 777 /tmp/crontab_`hostname`_old_$(date +%F).txt
zip -r /tmp/conf_`hostname`_old_$(date +%Y%m%d-%H%M%S).zip \
/etc/hosts \
/etc/sysctl.conf \
/etc/security/limits* \
/etc/passwd \
/etc/group \
/etc/fstab \
/etc/resolv.conf \
/etc/sysconfig/network-scripts/ifcfg-eth* \
/etc/sysconfig/network-scripts/route-eth* \
/etc/zabbix/zabbix_agentd.conf
chmod 777 /tmp/conf_*.zip
sudo su - root
echo '############ cpuinfo physical id ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ cpuinfo cpu cores ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
cat /proc/cpuinfo| grep "cpu cores"| uniq >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ cpuinfo processor ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
cat /proc/cpuinfo| grep "processor"| wc -l >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ cpuinfo name ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ cpuinfo siblings ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
cat /proc/cpuinfo | grep -e "cpu cores" -e "siblings" | sort | uniq >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ free -g ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
free -g >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ system-product-name ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
dmidecode -s system-product-name >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ lscpu ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
lscpu >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ release ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
cat /etc/redhat-release >> /tmp/hardware_`hostname`_old_$(date +%F).txt
cat /etc/oracle-release >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ pvs ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
pvs >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ vgs ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
vgs >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ lvs ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
lvs >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ fdisk -l ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
fdisk -l|grep 'Disk /dev' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ ip ad li ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
ip ad li|grep eth >> /tmp/hardware_`hostname`_old_$(date +%F).txt
echo '############ df -h ############' >> /tmp/hardware_`hostname`_old_$(date +%F).txt
df -h >> /tmp/hardware_`hostname`_old_$(date +%F).txt
chmod 777 /tmp/hardware_`hostname`_old_$(date +%F).txt
sz /tmp/hardware_`hostname`_old_$(date +%F).txt /tmp/conf_*.zip /tmp/crontab_`hostname`_old_$(date +%F).txt
EBS-Linux 操作系统标准化-配置备份
未经允许不得转载:徐万新之路 » EBS-Linux 操作系统标准化-配置备份
最新评论
这个牛
放下欲望,男人从来不醉,充分且必要
勇气、责任、自信、创新,为天下先!
软件即数据,软件即服务,软件即管理,软件就是对人类各种社会活动的仿真和记录。软件很重要,但软件不可能凌驾于业务之上,尤其不可能高人一等。