正德厚生,臻于至善

EBS-Linux 操作系统标准化-配置备份

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
赞(0) 打赏
未经允许不得转载:徐万新之路 » EBS-Linux 操作系统标准化-配置备份

评论 抢沙发

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫

微信扫一扫

登录

找回密码

注册