diff --git a/HOWTO b/HOWTO deleted file mode 100644 index 7f77fe6..0000000 --- a/HOWTO +++ /dev/null @@ -1,13 +0,0 @@ -1.执行pkg-install.sh安装32位库。 -./pkg-install.sh -2.执行setup.sh配置D5000环境。 -./setup.sh -3.执行generate.sh生成并配置序列号。 -./generate.sh -4.进入collect_hwinfo目录执行collect_hwinfo.sh收集硬件信息。 -cd collect_hwinfo -./collect_hwinfo.sh - -注意事项: -1.如果客户需要配置对时系统,则需要在执行完步骤2后编辑/usr/sbin/update_time.sh脚本设置NTPSERVER_A和NTPSERVER_B的地址(可以是IP,也可以是主机名,如果是主机名则需要在/etc/hosts文件中增加IP与主机名的对应关系)。 -2.以上操作建议在U盘环境完成,或在本地环境完成后删除配置脚本。 diff --git a/cgroupserial.sh b/cgroupserial.sh deleted file mode 100755 index b792fd7..0000000 --- a/cgroupserial.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -export LANG=c - -ROOT_UID=0 -E_ROOT=2 - -if [ $UID -ne $ROOT_UID ];then - echo "You must run this script use root ..." - exit $E_ROOT -fi - - -CGROUP_FILE=/etc/linxsn/cgroup_sn.conf -MAC=$(ifconfig eth0 | grep HWaddr | awk '{print $5}') -#value=$(echo $MAC | awk -F':' '{print $1,$2,$3,$4,$5,$6}') -cgroup_serial=$(./linx_cgroup_sn/linx_lxcgsn $MAC) -serial=$(echo $cgroup_serial | awk '{print $4}') -if [ ! -d /etc/linxsn ];then - mkdir /etc/linxsn -fi -echo "linx_serial=${serial}">${CGROUP_FILE} diff --git a/generate.sh b/generate.sh deleted file mode 100755 index 526c389..0000000 --- a/generate.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -export LANG=c - -ROOT_UID=0 -E_ROOT=2 - -if [ $UID -ne $ROOT_UID ];then - echo "You must run this script use root ..." - exit $E_ROOT -fi - - -GRUB_FILE=/boot/grub/menu.lst -MAC=$(ifconfig eth0 | grep HWaddr | awk '{print $5}') -value=$(echo $MAC | awk -F':' '{print $1,$2,$3,$4,$5,$6}') -linx_serial=$(./linx_sn/generate_serial $value ) -serial=$(echo $linx_serial | awk '{print $4}') -#判断rocky4.2.35和rocky4.2.39,因为这两个版本中/boot/grub/menu.lst文件中序列号的位置不同 -flag_4_2_39=`grep '4.2.39' /etc/issue|awk '{print $5}'` -if [ -z ${flag_4_2_39} ];then - for i in $(grep -n 'linx_serial' $GRUB_FILE | awk 'BEGIN{OFS="|"}{print $1,$5,$6}') - do - original_sn=$(echo $i | cut -d'|' -f2 | awk -F'=' '{print $2}') - line=$(echo $i | cut -d':' -f1) - - if [ ${original_sn}!=" " ];then - sed -i "${line}s@linx_serial=${original_sn}@linx_serial=@" $GRUB_FILE - if [ $(echo $i |grep 'rootflag') ];then - sed -i "${line}s@linx_serial=@linx_serial=${serial}@" $GRUB_FILE - else - sed -i "${line}s@linx_serial=@linx_serial=${serial} rootflags=data=writeback@" $GRUB_FILE - fi - else - if [ $(echo $i |grep 'rootflag') ];then - sed -i "${line}s@linx_serial=@linx_serial=${serial}@" $GRUB_FILE - else - sed -i "${line}s@linx_serial=@linx_serial=${serial} rootflags=data=writeback@" $GRUB_FILE - fi - fi - done -else - for i in `grep -n 'linx_serial' $GRUB_FILE | awk 'BEGIN{OFS="|"}{print $1,$4}'` - do - original_sn=$(echo $i | cut -d'|' -f2 | awk -F'=' '{print $2}') - line=$(echo $i | cut -d':' -f1) - - if [ ${original_sn}!=" " ];then - sed -i "${line}s@linx_serial=${original_sn}@linx_serial=@" $GRUB_FILE - if [ $(echo $i |grep 'rootflag') ];then - sed -i "${line}s@linx_serial=@linx_serial=${serial}@" $GRUB_FILE - else - sed -i "${line}s@linx_serial=@linx_serial=${serial} rootflags=data=writeback@" $GRUB_FILE - fi - else - if [ $(echo $i |grep 'rootflag') ];then - sed -i "${line}s@linx_serial=@linx_serial=${serial}@" $GRUB_FILE - else - sed -i "${line}s@linx_serial=@linx_serial=${serial} rootflags=data=writeback@" $GRUB_FILE - fi - fi - done - -fi - -sed -i "s#default 0#default 1#g" $GRUB_FILE - -rm /boot/grub/grub.conf -cp /boot/grub/menu.lst /boot/grub/grub.conf -chown sysadmin.sysadmin /boot/grub/menu.lst -chown sysadmin.sysadmin /boot/grub/grub.conf -echo "$linx_serial| `date` " >> ./linx_sn/linx_list diff --git a/haserial.sh b/haserial.sh deleted file mode 100755 index 6c13caa..0000000 --- a/haserial.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -export LANG=c - -ROOT_UID=0 -E_ROOT=2 - -if [ $UID -ne $ROOT_UID ];then - echo "You must run this script use root ..." - exit $E_ROOT -fi - - -HASERIAL_FILE=/etc/linxsn/HA_sn.conf -MAC=$(ifconfig eth0 | grep HWaddr | awk '{print $5}') -#value=$(echo $MAC | awk -F':' '{print $1,$2,$3,$4,$5,$6}') -ha_serial=$(./linx_ha_sn/linx_lxhasn $MAC) -serial=$(echo $ha_serial | awk '{print $4}') -if [ ! -d /etc/linxsn ];then - mkdir /etc/linxsn -fi -echo "linx_serial=${serial}">${HASERIAL_FILE} diff --git a/install_shell/alsa b/install_shell/alsa deleted file mode 100644 index 4d1a2c5..0000000 --- a/install_shell/alsa +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# /etc/rc.d/init.d/alsa: store/restore ALSA mixer levels -# - -# location of the alsactl executable -ALSACTL=/usr/sbin/alsactl - -case $1 in - start) - $ALSACTL restore - ;; - stop) - $ALSACTL store - ;; - restart) - $0 stop - sleep 2 - $0 start - ;; - *) - echo "Usage: $0 [start|stop|restart]" - ;; -esac - -# End of file diff --git a/install_shell/dmidecode b/install_shell/dmidecode deleted file mode 100755 index a193bed..0000000 Binary files a/install_shell/dmidecode and /dev/null differ diff --git a/install_shell/firefox25-Rocky4.2_x64/firefox.desktop b/install_shell/firefox25-Rocky4.2_x64/firefox.desktop deleted file mode 100755 index a45ad29..0000000 --- a/install_shell/firefox25-Rocky4.2_x64/firefox.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=Mozilla Firefox -Comment=Web Browser -Exec=/opt/firefox/firefox %U -Icon=/opt/firefox/browser/icons/mozicon128.png -Terminal=false -Type=Application -Categories=Application;Network; diff --git a/install_shell/firefox25-Rocky4.2_x64/install.sh b/install_shell/firefox25-Rocky4.2_x64/install.sh deleted file mode 100755 index 4129aa0..0000000 --- a/install_shell/firefox25-Rocky4.2_x64/install.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -#=============================================================================== -# -# FILE: install.sh -# -# USAGE: ./install.sh -# -# DESCRIPTION: -# -# OPTIONS: --- -# REQUIREMENTS: --- -# BUGS: --- -# NOTES: --- -# AUTHOR: sxxu (), sxxu@linx-info.com -# COMPANY: linx-info -# CREATED: 2013年12月19日 16时58分28秒 CST -# REVISION: --- -#=============================================================================== - -set -o nounset # Treat unset variables as an error - -echo clean fonts config files.. -rm -rf /etc/fonts/* -rf -for i in install/*.pkg.tar.gz -do - echo install $i ... - pkgadd -f $i -done -for i in update/*.pkg.tar.gz -do - echo update $i ... - pkgadd -u -f $i -done -echo install fonts .. -tar -xf update-fonts.tar.gz -C / -echo now install firefox to /opt/firefox .... -tar -xf firefox-25.0.1.zh-CN.linux-x86_64-Rocky4.2.tar.bz2 -C /opt -echo adjust flashplayer .... -mkdir -vp /usr/lib/mozilla/plugins/ -cp -vp libflashplayer.so /usr/lib/mozilla/plugins/ -cp -vf firefox.desktop /usr/share/applications -echo ok . run firefox as /opt/firefox/firefox diff --git a/install_shell/lshw b/install_shell/lshw deleted file mode 100755 index 3b86dbe..0000000 Binary files a/install_shell/lshw and /dev/null differ diff --git a/install_shell/other.sh b/install_shell/other.sh index 35967df..eb1ffe5 100755 --- a/install_shell/other.sh +++ b/install_shell/other.sh @@ -90,8 +90,6 @@ chmod 755 /usr/sbin/get_max_mem_process.sh #获取系统的部分日志或全部日志及系统相关信息的脚本 cp get_parameter_log.sh /usr/sbin/ -cp dmidecode /usr/sbin -cp lshw /usr/sbin cp check_sec_local.sh /usr/sbin cp os.sh /usr/sbin cp pci.ids /usr/share diff --git a/linx_cgroup_sn/linx_lxcgsn b/linx_cgroup_sn/linx_lxcgsn deleted file mode 100755 index 0b2c972..0000000 Binary files a/linx_cgroup_sn/linx_lxcgsn and /dev/null differ diff --git a/linx_ha_sn/linx_lxhasn b/linx_ha_sn/linx_lxhasn deleted file mode 100755 index 24f94f7..0000000 Binary files a/linx_ha_sn/linx_lxhasn and /dev/null differ diff --git a/linx_sn/generate_serial b/linx_sn/generate_serial deleted file mode 100755 index 699eb26..0000000 Binary files a/linx_sn/generate_serial and /dev/null differ diff --git a/linx_sn/linx_list b/linx_sn/linx_list deleted file mode 100644 index 486a187..0000000 --- a/linx_sn/linx_list +++ /dev/null @@ -1,63 +0,0 @@ -linx_serial is: 04:7d:7b:8b:37:86 1d8fe4eaafe7| Wed May 2 15:01:25 CST 2012 d1sca1 -linx_serial is: 04:7d:7b:8b:35:b2 1d8fe4eaadd3| Wed May 2 15:29:04 CST 2012 d1sca2 -linx_serial is: 04:7d:7b:8b:35:76 1d8fe4eaad17| Wed May 2 15:31:19 CST 2012 d2plan2 -linx_serial is: 04:7d:7b:8b:37:fe 1d8fe4eaaf9f| Wed May 2 15:34:08 CST 2012 d2scs1 -linx_serial is: 00:25:90:58:bf:34 19d70f392755| Wed May 2 17:25:59 CST 2012 sxscd1 -linx_serial is: 00:25:90:58:bf:5c 19d70f39273d| Wed May 2 17:33:00 CST 2012 sxhis1 -linx_serial is: 00:25:90:58:bf:04 19d70f392765| Wed May 2 17:36:45 CST 2012 sxscd2 -linx_serial is: 00:25:90:58:bf:38 19d70f392759| Wed May 2 18:21:56 CST 2012 sxfes2 -linx_serial is: 00:25:90:58:bd:4c 19d70f39252d| Wed May 2 18:24:05 CST 2012 sxhis2 -linx_serial is: 00:25:90:58:bf:06 19d70f392767| Wed May 2 18:26:06 CST 2012 sxfes1 -linx_serial is: 00:30:48:fe:ba:5c 19c2d79f223d| Wed May 9 18:42:37 CST 2012 js3-web05 -linx_serial is: 04:7d:7b:8b:41:16 1d8fe4ead977| Wed May 23 14:48:29 CST 2012 server01 -linx_serial is: 04:7d:7b:8b:42:2a 1d8fe4eada4b| Wed May 23 15:16:21 CST 2012 server02 -linx_serial is: 04:7d:7b:8b:40:b6 1d8fe4ead8d7| Wed May 23 15:45:55 CST 2012 server03 -linx_serial is: 04:7d:7b:8b:3b:ac 1d8fe4eaa3cd| Wed May 23 16:25:02 CST 2012 server04 -linx_serial is: 04:7d:7b:8b:40:da 1d8fe4ead8bb| Wed May 23 16:48:06 CST 2012 server05 -linx_serial is: 00:e0:81:de:2b:92 19121ebfb3f3| Thu May 24 11:34:59 CST 2012 tjbdpc01 -linx_serial is: 00:46:4b:72:6c:f7 19b4d413f496| 2012年 06月 22日 星期五 08:23:48 CST zj1-dksta05 -linx_serial is: 00:46:4b:72:6c:f7 19b4d413f496| 2012年 06月 22日 星期五 08:24:07 CST zj1-dksta05 -linx_serial is: e0:24:7f:06:14:1e f9d6e0678c7f| 2012年 06月 22日 星期五 08:53:27 CST zj1-dksta06 -linx_serial is: e0:24:7f:06:14:60 f9d6e0678c01| 2012年 06月 22日 星期五 18:32:09 CST zj1-dksta04 -linx_serial is: e0:24:7f:06:14:18 f9d6e0678c79| 2012年 06月 22日 星期五 18:51:33 CST zj1-dksta03 -linx_serial is: e0:24:7f:06:15:02 f9d6e0678d63| 2012年 06月 22日 星期五 19:06:23 CST zj1-dksta02 -linx_serial is: e0:24:7f:06:13:76 f9d6e0678b17| 2012年 06月 22日 星期五 19:20:50 CST zj1-dksta01 -linx_serial is: 2c:27:d7:ee:45:4e 35d5488fdd2f| Fri Jun 29 14:35:23 CST 2012 ncg-ii-disp1 -linx_serial is: 2c:27:d7:ee:45:4e 35d5488fdd2f| Fri Jun 29 14:35:25 CST 2012 ncg-ii-disp1 -linx_serial is: 2c:27:d7:ee:45:4e 35d5488fdd2f| Fri Jun 29 14:35:40 CST 2012 ncg-ii-disp1 -linx_serial is: 2c:27:d7:ee:e8:5f 35d5488f703e| Fri Jun 29 16:36:26 CST 2012 ncg-ii-disp2 -linx_serial is: 2c:27:d7:ee:55:69 35d5488fcd08| Fri Jun 29 16:57:06 CST 2012 ncg-ii-disp3 -linx_serial is: cc:52:af:3e:b1:68 d5a0305f2909| Tue Jul 10 10:47:06 CST 2012 sgpc35 -linx_serial is: cc:52:af:3e:af:e4 d5a0305f3785| Tue Jul 10 17:05:27 CST 2012 sgpc34 PBBKYRB -linx_serial is: cc:52:af:3e:b0:82 d5a0305f28e3| Tue Jul 10 17:10:18 CST 2012 sgpc33 -linx_serial is: cc:52:af:3e:b0:a2 d5a0305f28c3| Tue Jul 10 17:18:31 CST 2012 sgpc32 -linx_serial is: cc:52:af:3e:b1:78 d5a0305f2919| Tue Jul 10 18:16:44 CST 2012 sgpc31 -linx_serial is: cc:52:af:3e:b0:dc d5a0305f28bd| Tue Jul 10 18:23:17 CST 2012 sgpc30 -linx_serial is: cc:52:af:3e:b0:3e d5a0305f285f| Tue Jul 10 18:57:08 CST 2012 sgpc29 -linx_serial is: cc:52:af:3e:b0:6c d5a0305f280d| Tue Jul 10 19:01:50 CST 2012 sgpc36 -linx_serial is: 38:83:45:f2:2c:45 2171da93b424| Tue Jul 10 20:02:45 CST 2012 sgpc39 -linx_serial is: cc:52:af:3e:b0:9e d5a0305f28ff| Tue Jul 10 20:10:19 CST 2012 sgpc37 -linx_serial is: 38:83:45:f1:c1:dd 2171da9059bc| Tue Jul 10 20:33:50 CST 2012 sgpc40 -linx_serial is: 38:83:45:f2:15:bd 2171da938ddc| Tue Jul 10 20:41:31 CST 2012 sgpc28 -linx_serial is: cc:52:af:3e:b1:9c d5a0305f29fd| Tue Jul 10 20:48:10 CST 2012 sgpc38 -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 14:21:44 CST rocky4235 -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 14:26:12 CST rocky4235 -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 14:30:11 CST rocky4235 -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 15:16:43 CST rocky4235 -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 15:47:20 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 15:51:01 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 15:52:23 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 15:53:02 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 15:53:55 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 17:12:35 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 17:19:08 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 17:30:29 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 02日 星期二 17:30:31 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 08日 星期一 13:38:12 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 08日 星期一 13:38:14 CST -linx_serial is: 52:54:00:9e:d2:d6 4ba69fff4ab7| 2012年 10月 08日 星期一 16:52:27 CST -linx_serial is: 52:54:00:c2:8d:9b 4ba69fa315fa| 2013年 03月 29日 星期五 14:33:54 CST -Should greater than 7.| 2013年 05月 21日 星期二 16:17:45 CST -linx_serial is: b8:88:e3:31:f3:c8 a17a7c506ba9| Tue May 21 16:18:30 CST 2013 -linx_serial is: -52:54:00:24:82:33 4ba69f451a52| Sun Aug 4 01:02:04 CST 2013 diff --git a/linx_sn/linx_list-bak b/linx_sn/linx_list-bak deleted file mode 100644 index 09d0e4a..0000000 --- a/linx_sn/linx_list-bak +++ /dev/null @@ -1,18 +0,0 @@ -linx_serial is: 04:7d:7b:67:54:74 1d8fe406cc15| Wed Apr 25 10:35:20 CST 2012 d1fes1 -linx_serial is: 04:7d:7b:67:55:a6 1d8fe406cdc7| Wed Apr 25 10:38:25 CST 2012 d1fes2 -linx_serial is: 04:7d:7b:47:2c:18 1d8fe426b479| Wed Apr 25 10:39:34 CST 2012 d1gate1 -linx_serial is: 04:7d:7b:47:2f:00 1d8fe426b761| Wed Apr 25 10:40:37 CST 2012 d1gate2 -linx_serial is: 04:7d:7b:8b:37:44 1d8fe4eaaf25| Wed Apr 25 10:42:09 CST 2012 d1db1 -linx_serial is: 04:7d:7b:8b:35:a0 1d8fe4eaadc1| Wed Apr 25 10:43:07 CST 2012 d1db2 -linx_serial is: 04:7d:7b:47:31:d0 1d8fe426a9b1| Wed Apr 25 10:44:04 CST 2012 d1man1 -linx_serial is: 04:7d:7b:8b:38:46 1d8fe4eaa027| Wed Apr 25 10:44:49 CST 2012 d1ana1 -linx_serial is: 04:7d:7b:8b:36:ea 1d8fe4eaae8b| Wed Apr 25 10:45:21 CST 2012 d1pmu1 -linx_serial is: 04:7d:7b:47:2c:1e 1d8fe426b47f| Wed Apr 25 10:46:06 CST 2012 d1pas1 -linx_serial is: 04:7d:7b:8b:35:b8 1d8fe4eaadd9| Wed Apr 25 10:46:57 CST 2012 d2fes1 -linx_serial is: 04:7d:7b:47:2c:d2 1d8fe426b4b3| Wed Apr 25 10:47:44 CST 2012 d2gate1 -linx_serial is: 04:7d:7b:47:2f:ae 1d8fe426b7cf| Wed Apr 25 10:48:25 CST 2012 d2relay1 -linx_serial is: 04:7d:7b:47:31:2e 1d8fe426a94f| Wed Apr 25 10:49:04 CST 2012 d2plan1 -linx_serial is: 04:7d:7b:8b:35:c4 1d8fe4eaada5| Wed Apr 25 11:13:09 CST 2012 d2scs2 -linx_serial is: cc:52:af:3e:4b:f6 d5a0305fd397| Wed Apr 25 21:00:39 CST 2012 d1sta7 -linx_serial is: cc:52:af:3e:66:ce d5a0305ffeaf| Thu Apr 26 10:11:35 CST 2012 d1sta4 -linx_serial is: cc:52:af:3e:66:6c d5a0305ffe0d| Thu Apr 26 10:15:31 CST 2012 d1sta5 diff --git a/linx_sn/linx_list-wor b/linx_sn/linx_list-wor deleted file mode 100644 index 807830e..0000000 --- a/linx_sn/linx_list-wor +++ /dev/null @@ -1,27 +0,0 @@ -linx_serial is: cc:52:af:3e:66:34 d5a0305ffe55| Mon Apr 23 20:27:44 CST 2012 d1sta9 -linx_serial is: cc:52:af:3e:4a:6c d5a0305fd20d| Mon Apr 23 20:50:56 CST 2012 d1sta1 -linx_serial is: cc:52:af:3e:4b:fc d5a0305fd39d| Mon Apr 23 21:13:15 CST 2012 d1sta2 -linx_serial is: cc:52:af:3e:4a:1e d5a0305fd27f| Mon Apr 23 21:18:35 CST 2012 d1sta10 -linx_serial is: cc:52:af:3e:66:86 d5a0305ffee7| Mon Apr 23 21:26:23 CST 2012 d1sta8 -linx_serial is: cc:52:af:3e:4b:d8 d5a0305fd3b9| Mon Apr 23 21:50:08 CST 2012 d1sta16 -linx_serial is: cc:52:af:3e:4c:28 d5a0305fd449| Mon Apr 23 21:57:41 CST 2012 d1sta11 -linx_serial is: cc:52:af:3e:66:cc d5a0305ffead| Mon Apr 23 22:20:25 CST 2012 d2sta2 -linx_serial is: cc:52:af:3e:66:ce d5a0305ffeaf| Mon Apr 23 22:32:22 CST 2012 d1sta4 -linx_serial is: cc:52:af:3e:4b:f6 d5a0305fd397| Mon Apr 23 22:39:33 CST 2012 d1sta7 -linx_serial is: cc:52:af:3e:66:80 d5a0305ffee1| Mon Apr 23 22:57:46 CST 2012 d1sta15 -linx_serial is: cc:52:af:3e:66:4e d5a0305ffe2f| Mon Apr 23 23:11:01 CST 2012 d2sta1 -linx_serial is: cc:52:af:3e:67:12 d5a0305fff73| Mon Apr 23 23:34:43 CST 2012 d1sta6 -linx_serial is: cc:52:af:3e:4c:1e d5a0305fd47f| Mon Apr 23 23:48:01 CST 2012 d1sta14 -linx_serial is: cc:52:af:3e:4a:50 d5a0305fd231| Tue Apr 24 00:00:16 CST 2012 d2sta11 -linx_serial is: cc:52:af:3e:67:00 d5a0305fff61| Tue Apr 24 00:06:32 CST 2012 d2sta6 -linx_serial is: cc:52:af:3e:67:10 d5a0305fff71| Mon Apr 23 22:11:08 CST 2012 d1sta3 -linx_serial is: cc:52:af:3e:66:6e d5a0305ffe0f| Mon Apr 23 22:22:33 CST 2012 d2sta5 -linx_serial is: cc:52:af:3e:4b:d2 d5a0305fd3b3| Mon Apr 23 22:53:47 CST 2012 d2sta3 -linx_serial is: cc:52:af:3e:66:68 d5a0305ffe09| Mon Apr 23 23:04:09 CST 2012 d1sta12 -linx_serial is: cc:52:af:3e:66:6c d5a0305ffe0d| Mon Apr 23 23:30:01 CST 2012 d1sta5 -linx_serial is: cc:52:af:3e:66:d8 d5a0305ffeb9| Mon Apr 23 23:36:28 CST 2012 d1sta13 -linx_serial is: cc:52:af:3e:4a:70 d5a0305fd211| Mon Apr 23 23:47:06 CST 2012 d2sta8 -linx_serial is: cc:52:af:3e:4c:02 d5a0305fd463| Tue Apr 24 00:01:47 CST 2012 d2sta7 -linx_serial is: cc:52:af:3e:4b:dc d5a0305fd3bd| Tue Apr 24 00:24:21 CST 2012 d2sta10 -linx_serial is: cc:52:af:3e:67:0e d5a0305fff6f| Tue Apr 24 01:02:41 CST 2012 d2sta9 -linx_serial is: cc:52:af:3e:4b:d4 d5a0305fd3b5| Tue Apr 24 01:13:44 CST 2012 d2sta4 diff --git a/linx_sn/linx_list-xibei b/linx_sn/linx_list-xibei deleted file mode 100644 index 8f12935..0000000 --- a/linx_sn/linx_list-xibei +++ /dev/null @@ -1,10 +0,0 @@ -linx_serial is: 00:e0:81:cb:74:7d 19121eaaec1c| Fri Apr 27 13:18:17 CST 2012 s1 -linx_serial is: 00:e0:81:cb:75:d7 19121eaaedb6| Fri Apr 27 13:20:04 CST 2012 s3 -linx_serial is: 00:e0:81:cb:75:d6 19121eaaedb7| Fri Apr 27 13:21:46 CST 2012 s4 -linx_serial is: 00:e0:81:cb:7c:30 19121eaae451| Fri Apr 27 13:24:56 CST 2012 s5 -linx_serial is: 00:e0:81:cb:75:d3 19121eaaedb2| Fri Apr 27 13:25:40 CST 2012 s6 -linx_serial is: 00:e0:81:cb:7c:38 19121eaae459| Fri Apr 27 13:31:03 CST 2012 s9 -linx_serial is: 00:e0:81:cb:74:7e 19121eaaec1f| Fri Apr 27 20:11:15 CST 2012 localhost -linx_serial is: 00:e0:81:cb:7c:2f 19121eaae44e| Fri Apr 27 20:12:35 CST 2012 s7 -linx_serial is: 00:e0:81:cb:7c:32 19121eaae453| Fri Apr 27 20:14:24 CST 2012 s8 -linx_serial is: 00:e0:81:cb:e4:d6 19121eaa7cb7| Fri Apr 27 20:21:07 CST 2012 s2 diff --git a/linx_sn/linx_list.bak b/linx_sn/linx_list.bak deleted file mode 100644 index 9a0332e..0000000 --- a/linx_sn/linx_list.bak +++ /dev/null @@ -1,51 +0,0 @@ -linx_serial is: c8:0a:a9:da:d7:04 d1f836bb4f65| Mon Oct 17 11:08:36 CST 2011 -linx_serial is: c8:0a:a9:da:d7:04 d1f836bb4f65| Mon Oct 17 11:08:56 CST 2011 -linx_serial is: c8:0a:a9:da:d7:04 d1f836bb4f65| Mon Oct 17 11:09:23 CST 2011 -| Mon Dec 19 11:57:55 CST 2011 -linx_serial is: 00:15:17:a0:86:a0 19e788c11ec1| Mon Dec 19 19:47:05 CST 2011 -| 2012年 02月 22日 星期三 15:28:11 CST -| Wed Feb 22 17:04:26 CST 2012 -| Wed Feb 22 17:04:49 CST 2012 -| Wed Feb 22 17:04:54 CST 2012 -linx_serial is: b8:ac:6f:3b:2e:bc a15ef05ab6dd| Wed Feb 22 17:10:05 CST 2012 -linx_serial is: b8:ac:6f:47:69:c7 a15ef026f1a6| Wed Feb 22 18:04:27 CST 2012 -linx_serial is: 00:1b:21:af:c3:f2 19e9bece5b93| Thu Feb 23 16:31:33 CST 2012 -linx_serial is: f4:6d:04:53:e8:44 ed9f9b327025| Thu Feb 23 18:27:47 CST 2012 -linx_serial is: 00:15:17:a1:4a:34 19e788c0d255| Wed Feb 29 07:04:29 CST 2012 -| Tue Mar 13 15:28:44 CST 2012 -| Tue Mar 13 15:28:46 CST 2012 -linx_serial is: 00:e0:ed:20:92:54 191272410a35| Tue Mar 13 15:33:50 CST 2012 -linx_serial is: 00:e0:81:cb:59:b7 19121eaac1d6| Tue Mar 13 15:36:32 CST 2012 -| Wed Mar 14 10:22:23 CST 2012 -| Wed Mar 14 10:22:25 CST 2012 -linx_serial is: 00:e0:81:c4:28:de 19121ea5b0bf| 2012 03 14 10:30:48 CST -| 2012 03 14 10:56:00 CST -| 2012 03 14 10:56:06 CST -linx_serial is: 00:e0:81:c4:28:e4 19121ea5b085| 2012 03 14 11:01:36 CST -linx_serial is: 00:e0:81:c4:0b:52 19121ea59333| 2012 03 10 18:26:52 CST -linx_serial is: 00:25:90:65:f8:50 19d70f046031| Wed Mar 28 06:23:35 CST 2012 -linx_serial is: 8c:89:a5:c3:f4:6e 957b3aa26c0f| Thu Apr 5 19:26:41 CST 2012 -linx_serial is: 8c:89:a5:c3:f4:68 957b3aa26c09| Thu Apr 5 19:33:10 CST 2012 -| Thu Apr 5 19:44:12 CST 2012 -| Thu Apr 5 19:44:15 CST 2012 -linx_serial is: 8c:89:a5:c3:ef:36 957b3aa27757| Thu Apr 5 19:47:34 CST 2012 -linx_serial is: 8c:89:a5:c3:f4:76 957b3aa26c17| Thu Apr 5 19:48:25 CST 2012 -linx_serial is: 8c:89:a5:c3:f3:f2 957b3aa26b93| Thu Apr 5 20:28:08 CST 2012 -linx_serial is: 00:e0:ed:1e:4b:90 1912727fd3f1| Fri Apr 6 12:21:37 CST 2012 -linx_serial is: 00:e0:ed:1d:3d:0e 1912727ca56f| Fri Apr 6 12:44:44 CST 2012 -linx_serial is: 00:e0:81:ca:83:2c 19121eab1b4d| Fri Apr 6 13:43:51 CST 2012 -linx_serial is: c8:60:00:00:b2:90 d1929f612af1| Thu Apr 12 17:35:46 CST 2012 -| Thu Apr 12 17:53:41 CST 2012 -linx_serial is: c8:60:00:12:70:94 d1929f73e8f5| Thu Apr 12 17:56:17 CST 2012 -linx_serial is: c8:60:00:00:b2:82 d1929f612ae3| Thu Apr 12 18:02:10 CST 2012 -linx_serial is: c8:60:00:00:b2:86 d1929f612ae7| Thu Apr 12 18:14:25 CST 2012 -linx_serial is: c8:60:00:12:71:9a d1929f73e9fb| Thu Apr 12 18:19:00 CST 2012 -linx_serial is: c8:60:00:00:b2:6e d1929f612a0f| Thu Apr 12 18:26:10 CST 2012 -linx_serial is: 00:1b:21:c9:09:c4 19e9bea891a5| Fri Apr 13 10:10:09 CST 2012 -linx_serial is: 00:1b:21:c9:0f:78 19e9bea89719| Fri Apr 13 10:50:12 CST 2012 -linx_serial is: 00:1b:21:c9:0f:14 19e9bea89775| Fri Apr 13 11:14:18 CST 2012 -linx_serial is: 00:1b:21:c9:ff:d4 19e9bea867b5| Fri Apr 13 11:30:11 CST 2012 -linx_serial is: 00:1b:21:c9:12:20 19e9bea88a41| Fri Apr 13 11:31:20 CST 2012 -linx_serial is: 00:1b:21:ca:00:70 19e9beab9811| Fri Apr 13 11:32:09 CST 2012 -linx_serial is: 70:f3:95:04:79:e0 69010a65e181| Thu Apr 19 14:53:08 CST 2012 -linx_serial is: cc:52:af:3e:66:34 d5a0305ffe55| Mon Apr 23 20:26:35 CST 2012 diff --git a/linx_sn/shanghai-d1pas1 b/linx_sn/shanghai-d1pas1 deleted file mode 100644 index ac2ef8f..0000000 --- a/linx_sn/shanghai-d1pas1 +++ /dev/null @@ -1 +0,0 @@ -hostname:d1pas1 MAC:60:eb:69:82:3a:fa :7919f6e3a29b 机器号:nc00862965 diff --git a/other_shell/addfonts b/other_shell/addfonts deleted file mode 100644 index 7f9c74c..0000000 --- a/other_shell/addfonts +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - - -ROOT_UID=0 -E_ROOT=2 - -if [ $UID -ne $ROOT_UID ];then - echo "You must run this script use root ..." - exit $E_ROOT -fi - -Fonts_DIR=/usr/share/fonts/truetype/arphic/ - -if [ "$1" = ' ' ];then - echo "Usage:[FONTS]" - exit 1 -else - cp "$1" $Fonts_DIR - cd $Fonts_DIR - mkfontscale - mkfontdir - fc-cache -f -fi diff --git a/other_shell/check_date b/other_shell/check_date deleted file mode 100644 index 0516176..0000000 --- a/other_shell/check_date +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# author:xwang@linx-info.com - - -my_host=`hostname` -cur_dir=`pwd` -cur_date=`date "+%y-%m-%d_%H_%M_%S"` -Nlst=${HOME}/conf/deliver_hosts_linux.sys - - -if [ -f $HOME/connect-list ];then - rm $HOME/connect-list -fi - -if [ "$1" != "" ];then - Nlst=$1 -fi - -trap 'exit' 2 -for i in `cat $Nlst` -do - ping -c 1 -w 1 $i > /dev/null - if [ $? -gt 0 ];then - echo "ping $i failed,please check your line.." - else - echo "Host:$i" - ssh $i date 2> /dev/null - echo $i >> ${HOME}/connect-list - fi -done diff --git a/other_shell/chinput b/other_shell/chinput deleted file mode 100644 index e68fe58..0000000 --- a/other_shell/chinput +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -IM_CONFIG=/usr/share/config/kdm/Xsession - -if [ "$1" = "scim" ];then - imethod=fcitx -elif [ "$1" = "fcitx" ];then - imethod=scim -else - echo "Usage:[fcitx | scim]" - exit 1 -fi - - -line1=$(grep -n $1 $IM_CONFIG | tail -n 1 | cut -d: -f1) -line2=$(grep -n ${imethod} $IM_CONFIG | tail -n 1 | cut -d: -f1) - -grep $1 $IM_CONFIG | tail -n 1 | grep '#' &> /dev/null -if [ $? -eq 0 ];then - sed -i "${line1}s@#@@" $IM_CONFIG - sed -i "${line2}s@^@#&@" $IM_CONFIG - echo "$1 change successful." -else - echo "$1 already." - exit 0 -fi - diff --git a/other_shell/chkernel b/other_shell/chkernel deleted file mode 100644 index 75c310b..0000000 --- a/other_shell/chkernel +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -Boot_CONFIG=/boot/grub/grub.conf - -ROOT=$(cat /boot/grub/grub.conf |grep -v ^# |grep title | nl -b a -v 0 | grep -w with | awk '{print $1}') -NOROOT=$(cat /boot/grub/grub.conf |grep -v ^# | grep title | nl -b a -v 0 | grep -w without | awk '{print $1}') - -if [ "$1" = "root" ];then - sed -i "/default/s@[0-9]@${ROOT}@" $Boot_CONFIG -elif [ "$1" = "noroot" ];then - sed -i "/default/s@[0-9]@${NOROOT}@" $Boot_CONFIG -else - echo "Usage:[root | noroot]" - exit 1 -fi diff --git a/other_shell/connect-check.sh b/other_shell/connect-check.sh deleted file mode 100755 index ab643fc..0000000 --- a/other_shell/connect-check.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -for i in `cat $1` -do - trap 'exit' 2 - ping -c 1 -w 1 $i > /dev/null - if [ $? -gt 0 ];then - echo ping $i failed,skip!! - else - echo $i -----ping ok------ - fi -done diff --git a/other_shell/summary b/other_shell/summary deleted file mode 100755 index b008d11..0000000 --- a/other_shell/summary +++ /dev/null @@ -1,1197 +0,0 @@ -#!/bin/sh -# This program is part of Aspersa (http://code.google.com/p/aspersa/) - -# ######################################################################## -# A script to summarize system information in a nice way. -# Goals: work well on Linux; create a compact diff-able report that is -# easy to paste into a wiki or email, and easy to scan and compare too. -# -# Usage: $ wget -O- http://aspersa.googlecode.com/svn/trunk/summary |bash -# Options are set through the ASPERSA_SKIP environment variable. Set this -# variable to a comma-separated list of things you want to omit. -# Options: -# MOUNT: Don't print out mounted filesystems and disk fullness. -# NETWORK: Don't print out information on network controllers & config. -# PROCESS: Don't print out top processes and vmstat information. -# -# Authors: -# Baron Schwartz -# Kevin van Zonneveld (kvz@php.net || http://kevin.vanzonneveld.net) -# ######################################################################## - -# ######################################################################## -# Globals, settings, helper functions -# ######################################################################## -POSIXLY_CORRECT=1 -export POSIXLY_CORRECT - -# The awk code for fuzzy rounding. (It's used in a few places, so makes sense -# not to duplicate). It fuzzy-rounds the variable named fuzzy_var. It goes in -# steps of 5, 10, 25, then repeats by a factor of 10 larger (50, 100, 250), and -# so on, until it finds a number that's large enough. The pattern is slightly -# broken between the initial 1 and 50, because rounding to the nearest 2.5 -# doesn't seem right to me. -fuzzy_formula=' - rounded = 0; - if (fuzzy_var <= 10 ) { - rounded = 1; - } - factor = 1; - while ( rounded == 0 ) { - if ( fuzzy_var <= 50 * factor ) { - fuzzy_var = sprintf("%.0f", fuzzy_var / (5 * factor)) * 5 * factor; - rounded = 1; - } - else if ( fuzzy_var <= 100 * factor) { - fuzzy_var = sprintf("%.0f", fuzzy_var / (10 * factor)) * 10 * factor; - rounded = 1; - } - else if ( fuzzy_var <= 250 * factor) { - fuzzy_var = sprintf("%.0f", fuzzy_var / (25 * factor)) * 25 * factor; - rounded = 1; - } - factor = factor * 10; - }' - -# Does fuzzy rounding: rounds to nearest interval, but the interval gets larger -# as the number gets larger. This is to make things easier to diff. -fuzz () { - echo $1 | $AP_AWK "{fuzzy_var=\$1; ${fuzzy_formula} print fuzzy_var;}" -} - -# The temp files are for storing working results so we don't call commands many -# times (gives inconsistent results, maybe adds load on things I don't want to -# such as RAID controllers). They must not exist -- if they did, someone would -# symlink them to /etc/passwd and then run this program as root. Call this -# function with "rm" or "touch" as an argument. -temp_files() { - for file in /tmp/aspersa /tmp/aspersa2; do - case "$1" in - touch) - if ! touch "${file}"; then - echo "I can't make my temp file ${file}"; - exit 1; - fi - ;; - rm) - rm -f "${file}" - ;; - esac - done -} - -# Print a space-padded string into $line. Then translate spaces to hashes, and -# underscores to spaces. End result is a line of hashes with words at the -# start. -section () { - echo "$1" | awk '{l=sprintf("#_%-60s", $0 "_"); print l}' | sed -e 's/ /#/g' -e 's/_/ /g' -} - -# Print a "name | value" line. -name_val() { - printf "%12s | %s\n" "$1" "$(echo $2)" -} - -# Converts a value to units of power of 2. Arg 1: the value. Arg 2: precision (defaults to 2). -shorten() { - echo $@ | awk '{ - unit = "k"; - size = 1024; - val = $1; - prec = 2; - if ( $2 ~ /./ ) { - prec = $2; - } - if ( val >= 1099511627776 ) { - size = 1099511627776; - unit = "T"; - } - else if ( val >= 1073741824 ) { - size = 1073741824; - unit = "G"; - } - else if ( val >= 1048576 ) { - size = 1048576; - unit = "M"; - } - printf "%." prec "f%s", val / size, unit; - }' -} - -# ############################################################################## -# Function to take a file and collapse it into an aggregated list. This -# function works on $1, which it expects to be created with 'sort | -# uniq -c'. Leading whitespace is deleted. The result will look like -# "4xabc, 1xdef" Copy any changes to 'mysql-summary' too. -# ############################################################################## -group_concat () { - sed -e '{H; $!d}' -e 'x' -e 's/\n[[:space:]]*\([[:digit:]]*\)[[:space:]]*/, \1x/g' -e 's/[[:space:]][[:space:]]*/ /g' -e 's/, //' ${1} - # In words: save the whole file into the hold space, - # {H; $!d} - # Swap it back into the pattern space, - # x - # Join lines with a comma, delete leading whitespace, and put an 'x' between - # the number and the text that follows, - # s/\n[[:space:]]*\([[:digit:]]*\)[[:space:]]*/, \1x/g - # Collapse whitespace, - # s/[[:space:]][[:space:]]*/ /g - # And delete the leading comma-space. - # s/, // -} - -# ############################################################################## -# Functions for parsing specific files and getting desired info from them. -# These are called from within main() and are separated so they can be tested -# easily. The calling convention is that the data they need to run is prepared -# first by putting it into /tmp/aspersa. Then code that's testing just needs to -# put sample data into /tmp/aspersa and call it. -# ############################################################################## - -# ############################################################################## -# Parse Linux's /proc/cpuinfo, which should be stored in /tmp/aspersa. -# ############################################################################## -parse_proc_cpuinfo () { - # Physical processors are indicated by distinct 'physical id'. Virtual CPUs - # are indicated by paragraphs -- one per paragraph. We assume that all - # processors are identical, i.e. that there are not some processors with dual - # cores and some with quad cores. - virtual=$(grep -c ^processor /tmp/aspersa); - physical=$(grep 'physical id' /tmp/aspersa | sort -u | wc -l); - cores=$(grep 'cpu cores' /tmp/aspersa | head -n 1 | cut -d: -f2); - - # Older kernel won't have 'physical id' or 'cpu cores'. - if [ "${physical}" = "0" ]; then physical=${virtual}; fi - if [ -z "${cores}" ]; then cores=0; fi - - # Test for HTT; cannot trust the 'ht' flag. If physical * cores < virtual, - # then hyperthreading is in use. - cores=$((${cores} * ${physical})); - if [ ${cores} -gt 0 -a $cores -lt $virtual ]; then htt=yes; else htt=no; fi - - name_val "Processors" "physical = ${physical}, cores = ${cores}, virtual = ${virtual}, hyperthreading = ${htt}" - - awk -F: '/cpu MHz/{print $2}' /tmp/aspersa \ - | sort | uniq -c > /tmp/aspersa2 - name_val "Speeds" "$(group_concat /tmp/aspersa2)" - - awk -F: '/model name/{print $2}' /tmp/aspersa \ - | sort | uniq -c > /tmp/aspersa2 - name_val "Models" "$(group_concat /tmp/aspersa2)" - - awk -F: '/cache size/{print $2}' /tmp/aspersa \ - | sort | uniq -c > /tmp/aspersa2 - name_val "Caches" "$(group_concat /tmp/aspersa2)" -} - -# ############################################################################## -# Parse sysctl -a output on FreeBSD, and format it as CPU info. The file is the -# first argument. -# ############################################################################## -parse_sysctl_cpu_freebsd() { - virtual="$(awk '/hw.ncpu/{print $2}' "$1")" - name_val "Processors" "virtual = ${virtual}" - name_val "Speeds" "$(awk '/hw.clockrate/{print $2}' "$1")" - name_val "Models" "$(awk -F: '/hw.model/{print substr($2, 2)}' "$1")" -} - -# ############################################################################## -# Parse CPU info from psrinfo -v -# ############################################################################## -parse_psrinfo_cpus() { - name_val Processors $(grep -c 'Status of .* processor' "$1") - awk '/operates at/ { - start = index($0, " at ") + 4; - end = length($0) - start - 4 - print substr($0, start, end); - }' "$1" | sort | uniq -c > /tmp/aspersa2 - name_val "Speeds" "$(group_concat /tmp/aspersa2)" -} - -# ############################################################################## -# Parse the output of 'free -b' plus the contents of /proc/meminfo -# ############################################################################## -parse_free_minus_b () { - physical=$(awk '/Mem:/{print $3}' "${1}") - swap=$(awk '/Swap:/{print $3}' "${1}") - virtual=$(shorten $(($physical + $swap))) - - name_val Total $(shorten $(awk '/Mem:/{print $2}' "${1}")) - name_val Free $(shorten $(awk '/Mem:/{print $4}' "${1}")) - name_val Used "physical = $(shorten ${physical}), swap = $(shorten ${swap}), virtual = ${virtual}" - name_val Buffers $(shorten $(awk '/Mem:/{print $6}' "${1}")) - name_val Caches $(shorten $(awk '/Mem:/{print $7}' "${1}")) - name_val Dirty "$(awk '/Dirty:/ {print $2, $3}' "${1}")" -} - -# ############################################################################## -# Parse FreeBSD memory info from sysctl output. -# ############################################################################## -parse_memory_sysctl_freebsd() { - physical=$(awk '/hw.realmem:/{print $2}' "${1}") - mem_hw=$(awk '/hw.physmem:/{print $2}' "${1}") - mem_used=$(awk ' - /hw.physmem/ { mem_hw = $2; } - /vm.stats.vm.v_inactive_count/ { mem_inactive = $2; } - /vm.stats.vm.v_cache_count/ { mem_cache = $2; } - /vm.stats.vm.v_free_count/ { mem_free = $2; } - /hw.pagesize/ { pagesize = $2; } - END { - mem_inactive *= pagesize; - mem_cache *= pagesize; - mem_free *= pagesize; - print mem_hw - mem_inactive - mem_cache - mem_free; - } - ' "$1"); - name_val Total $(shorten ${mem_hw} 1) - name_val Virtual $(shorten ${physical} 1) - name_val Used $(shorten ${mem_used} 1) -} - -# ############################################################################## -# Parse memory devices from the output of 'dmidecode', which should be stored in -# /tmp/aspersa. -# ############################################################################## -parse_dmidecode_mem_devices () { - echo " Locator Size Speed Form Factor Type Type Detail" - echo " ========= ======== ================= ============= ============= ===========" - # Print paragraphs containing 'Memory Device\n', extract the desired bits, - # concatenate them into one long line, then format as a table. The data - # comes out in this order for each paragraph: - # $2 Size 2048 MB - # $3 Form Factor - # $4 Locator DIMM1 - # $5 Type - # $6 Type Detail Synchronous - # $7 Speed 667 MHz (1.5 ns) - sed -e '/./{H;$!d;}' \ - -e 'x;/Memory Device\n/!d;' \ - -e 's/: /:/g' \ - -e 's//}/g' \ - -e 's/[ \t]*\n/\n/g' \ - /tmp/aspersa \ - | awk -F: '/Size|Type|Form.Factor|Type.Detail|[^ ]Locator/{printf("|%s", $2)}/Speed/{print "|" $2}' \ - | sed -e 's/No Module Installed/{EMPTY}/' \ - | sort \ - | awk -F'|' '{printf(" %-9s %-8s %-17s %-13s %-13s %-8s\n", $4, $2, $7, $3, $5, $6);}' -} - -# ############################################################################## -# Parse the output of 'netstat -antp' -# ############################################################################## -parse_ip_s_link () { - echo " interface rx_bytes rx_packets rx_errors tx_bytes tx_packets tx_errors" - echo " ========= ========= ========== ========== ========== ========== ==========" - - awk "/^[1-9][0-9]*:/ { - save[\"iface\"] = substr(\$2, 0, index(\$2, \":\") - 1); - new = 1; - } - \$0 !~ /[^0-9 ]/ { - if ( new == 1 ) { - new = 0; - fuzzy_var = \$1; ${fuzzy_formula} save[\"bytes\"] = fuzzy_var; - fuzzy_var = \$2; ${fuzzy_formula} save[\"packs\"] = fuzzy_var; - fuzzy_var = \$3; ${fuzzy_formula} save[\"errs\"] = fuzzy_var; - } - else { - fuzzy_var = \$1; ${fuzzy_formula} tx_bytes = fuzzy_var; - fuzzy_var = \$2; ${fuzzy_formula} tx_packets = fuzzy_var; - fuzzy_var = \$3; ${fuzzy_formula} tx_errors = fuzzy_var; - printf \" %-8s %10d %10d %10d %10d %10d %10d\\n\", save[\"iface\"], save[\"bytes\"], save[\"packs\"], save[\"errs\"], tx_bytes, tx_packets, tx_errors; - } - }" $@ -} - -# ############################################################################## -# Parse the output of 'netstat -antp' which should be in /tmp/aspersa. -# ############################################################################## -parse_netstat () { - echo " Connections from remote IP addresses" - awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ { - print substr($5, 0, index($5, ":") - 1); - }' /tmp/aspersa | sort | uniq -c \ - | awk "{ - fuzzy_var=\$1; - ${fuzzy_formula} - printf \" %-15s %5d\\n\", \$2, fuzzy_var; - }" \ - | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 - echo " Connections to local IP addresses" - awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ { - print substr($4, 0, index($4, ":") - 1); - }' /tmp/aspersa | sort | uniq -c \ - | awk "{ - fuzzy_var=\$1; - ${fuzzy_formula} - printf \" %-15s %5d\\n\", \$2, fuzzy_var; - }" \ - | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 - echo " Connections to top 10 local ports" - awk '$1 ~ /^tcp/ && $5 ~ /^[1-9]/ { - print substr($4, index($4, ":") + 1); - }' /tmp/aspersa | sort | uniq -c | sort -rn | head -n10 \ - | awk "{ - fuzzy_var=\$1; - ${fuzzy_formula} - printf \" %-15s %5d\\n\", \$2, fuzzy_var; - }" | sort - echo " States of connections" - awk '$1 ~ /^tcp/ { - print $6; - }' /tmp/aspersa | sort | uniq -c | sort -rn \ - | awk "{ - fuzzy_var=\$1; - ${fuzzy_formula} - printf \" %-15s %5d\\n\", \$2, fuzzy_var; - }" | sort -} - -# ############################################################################## -# Parse the joined output of 'mount' and 'df -hP'. $1 = file; $2 = ostype. -# ############################################################################## -parse_filesystems () { - # Filesystem names and mountpoints can be very long. We try to align things - # as nicely as possible by making columns only as wide as needed. This - # requires two passes through the file. The first pass finds the max size of - # these columns and prints out a printf spec, and the second prints out the - # file nicely aligned. - cat > /tmp/aspersa.awk <<-EOF - BEGIN { - device = 10; - fstype = 4; - options = 4; - } - /./ { - f_device = \$1; - f_fstype = \$10; - f_options = substr(\$11, 2, length(\$11) - 2); - if ( "$2" == "FreeBSD" ) { - f_fstype = substr(\$9, 2, length(\$9) - 2); - f_options = substr(\$0, index(\$0, ",") + 2); - f_options = substr(f_options, 1, length(f_options) - 1); - } - if ( length(f_device) > device ) { - device=length(f_device); - } - if ( length(f_fstype) > fstype ) { - fstype=length(f_fstype); - } - if ( length(f_options) > options ) { - options=length(f_options); - } - } - END{ - print "%-" device "s %5s %4s %-" fstype "s %-" options "s %s"; - } - EOF - spec="$( awk -f /tmp/aspersa.awk "$1" )"; - #awk -f /tmp/aspersa.awk "$1" - #return; - - cat > /tmp/aspersa.awk <<-EOF - BEGIN { - spec=" ${spec}\\n"; - printf spec, "Filesystem", "Size", "Used", "Type", "Opts", "Mountpoint"; - } - { - f_fstype = \$10; - f_options = substr(\$11, 2, length(\$11) - 2); - if ( "$2" == "FreeBSD" ) { - f_fstype = substr(\$9, 2, length(\$9) - 2); - f_options = substr(\$0, index(\$0, ",") + 2); - f_options = substr(f_options, 1, length(f_options) - 1); - } - printf spec, \$1, \$2, \$5, f_fstype, f_options, \$6; - } - EOF - awk -f /tmp/aspersa.awk "$1" -} - -# ############################################################################## -# Parse the output of fdisk -l, which should be in /tmp/aspersa; there might be -# multiple fdisk -l outputs in the file. -# ############################################################################## -parse_fdisk () { - awk ' - BEGIN { - format="%-12s %4s %10s %10s %18s\n"; - printf(format, "Device", "Type", "Start", "End", "Size"); - printf(format, "============", "====", "==========", "==========", "=================="); - } - /Disk.*bytes/ { - disk = substr($2, 1, length($2) - 1); - size = $5; - printf(format, disk, "Disk", "", "", size); - } - /Units/ { - units = $9; - } - /^\/dev/ { - if ( $2 == "*" ) { - start = $3; - end = $4; - } - else { - start = $2; - end = $3; - } - printf(format, $1, "Part", start, end, sprintf("%.0f", (end - start) * units)); - } - ' /tmp/aspersa -} - -# ############################################################################## -# Parse the output of dmesg, which should be in /tmp/aspersa, and detect -# virtualization. -# ############################################################################## -parse_virtualization_dmesg () { - if grep -qi -e vmware -e vmxnet -e 'paravirtualized kernel on vmi' /tmp/aspersa; then - echo "VMWare"; - elif grep -qi -e 'paravirtualized kernel on xen' -e 'Xen virtual console' /tmp/aspersa; then - echo "Xen"; - elif grep -qi qemu /tmp/aspersa; then - echo "QEmu"; - elif grep -qi 'paravirtualized kernel on KVM' /tmp/aspersa; then - echo "KVM"; - elif grep -q VBOX /tmp/aspersa; then - echo "VirtualBox"; - elif grep -qi 'hd.: Virtual .., ATA.*drive' /tmp/aspersa; then - echo "Microsoft VirtualPC"; - fi -} - -# ############################################################################## -# Try to figure out if a system is a guest by looking at prtdiag, smbios, etc. -# ############################################################################## -parse_virtualization_generic() { - if grep -i -e virtualbox "$1" >/dev/null; then - echo VirtualBox - elif grep -i -e vmware "$1" >/dev/null; then - echo VMWare - fi -} - -# ############################################################################## -# Parse the output of lspci, which should be in /tmp/aspersa, and detect -# Ethernet cards. -# ############################################################################## -parse_ethernet_controller_lspci () { - grep -i ethernet /tmp/aspersa | cut -d: -f3 | while read line; do - name_val Controller "${line}" - done -} - -# ############################################################################## -# Parse the output of lspci, which should be in /tmp/aspersa, and detect RAID -# controllers. -# ############################################################################## -parse_raid_controller_lspci () { - if grep -q "RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS" /tmp/aspersa; then - echo 'LSI Logic MegaRAID SAS' - elif grep -q "Fusion-MPT SAS" /tmp/aspersa; then - echo 'Fusion-MPT SAS' - elif grep -q "RAID bus controller: LSI Logic / Symbios Logic Unknown" /tmp/aspersa; then - echo 'LSI Logic Unknown' - elif grep -q "RAID bus controller: Adaptec AAC-RAID" /tmp/aspersa; then - echo 'AACRAID' - elif grep -q "3ware [0-9]* Storage Controller" /tmp/aspersa; then - echo '3Ware' - elif grep -q "Hewlett-Packard Company Smart Array" /tmp/aspersa; then - echo 'HP Smart Array' - elif grep -q " RAID bus controller: " /tmp/aspersa; then - awk -F: '/RAID bus controller\:/ {print $3" "$5" "$6}' /tmp/aspersa - fi -} - -# ############################################################################## -# Parse the output of dmesg, which should be in /tmp/aspersa, and detect RAID -# controllers. -# ############################################################################## -parse_raid_controller_dmesg () { - pat='scsi[0-9].*: .*' - if grep -qi "${pat}megaraid" /tmp/aspersa; then - echo 'LSI Logic MegaRAID SAS' - elif grep -q "Fusion MPT SAS" /tmp/aspersa; then - echo 'Fusion-MPT SAS' - elif grep -q "${pat}aacraid" /tmp/aspersa; then - echo 'AACRAID' - elif grep -q "${pat}3ware [0-9]* Storage Controller" /tmp/aspersa; then - echo '3Ware' - fi -} - -# ############################################################################## -# Parse the output of "hpacucli ctrl all show config", which should be stored in -# /tmp/aspersa -# ############################################################################## -parse_hpacucli () { - grep 'logicaldrive\|physicaldrive' /tmp/aspersa -} - -# ############################################################################## -# Parse the output of arcconf, which should be stored in /tmp/aspersa -# ############################################################################## -parse_arcconf () { - model=$(awk -F: '/Controller Model/{print $2}' /tmp/aspersa) - chan="$(awk -F: '/Channel description/{print $2}' /tmp/aspersa)" - cache="$(awk -F: '/Installed memory/{print $2}' /tmp/aspersa)" - status="$(awk -F: '/Controller Status/{print $2}' /tmp/aspersa)" - name_val Specs "${model/ /},${chan},${cache} cache,${status}" - - battery=$(grep -A5 'Controller Battery Info' /tmp/aspersa \ - | awk '/Capacity remaining/ {c=$4} - /Status/ {s=$3} - /Time remaining/ {t=sprintf("%dd%dh%dm", $7, $9, $11)} - END {printf("%d%%, %s remaining, %s", c, t, s)}') - name_val Battery "${battery}" - - # ########################################################################### - # Logical devices - # ########################################################################### - echo - echo " LogicalDev Size RAID Disks Stripe Status Cache" - echo " ========== ========= ==== ===== ====== ======= =======" - for dev in $(awk '/Logical device number/{print $4}' /tmp/aspersa); do - sed -n -e "/^Logical device .* ${dev}$/,/^$\|^Logical device number/p" \ - /tmp/aspersa \ - | awk ' - /Logical device name/ {d=$5} - /Size/ {z=$3 " " $4} - /RAID level/ {r=$4} - /Group [0-9]/ {g++} - /Stripe-unit size/ {p=$4 " " $5} - /Status of logical/ {s=$6} - /Write-cache mode.*Ena.*write-back/ {c="On (WB)"} - /Write-cache mode.*Ena.*write-thro/ {c="On (WT)"} - /Write-cache mode.*Disabled/ {c="Off"} - END { - printf(" %-10s %-9s %4d %5d %-6s %-7s %-7s\n", - d, z, r, g, p, s, c); - }' - done - - # ########################################################################### - # Physical devices - # ########################################################################### - echo - echo " PhysiclDev State Speed Vendor Model Size Cache" - echo " ========== ======= ============= ======= ============ =========== =======" - - # Find the paragraph with physical devices, tabularize with assoc arrays. - tempresult="" - sed -n -e '/Physical Device information/,/^$/p' /tmp/aspersa \ - | awk -F: ' - /Device #[0-9]/ { - device=substr($0, index($0, "#")); - devicenames[device]=device; - } - /Device is a/ { - devices[device ",isa"] = substr($0, index($0, "is a") + 5); - } - /State/ { - devices[device ",state"] = substr($2, 2); - } - /Transfer Speed/ { - devices[device ",speed"] = substr($2, 2); - } - /Vendor/ { - devices[device ",vendor"] = substr($2, 2); - } - /Model/ { - devices[device ",model"] = substr($2, 2); - } - /Size/ { - devices[device ",size"] = substr($2, 2); - } - /Write Cache/ { - if ( $2 ~ /Enabled .write-back./ ) - devices[device ",cache"] = "On (WB)"; - else - if ( $2 ~ /Enabled .write-th/ ) - devices[device ",cache"] = "On (WT)"; - else - devices[device ",cache"] = "Off"; - } - END { - for ( device in devicenames ) { - if ( devices[device ",isa"] ~ /Hard drive/ ) { - printf(" %-10s %-7s %-13s %-7s %-12s %-11s %-7s\n", - devices[device ",isa"], - devices[device ",state"], - devices[device ",speed"], - devices[device ",vendor"], - devices[device ",model"], - devices[device ",size"], - devices[device ",cache"]); - } - } - }' - -} - -# ############################################################################## -# Parse the output of "lsiutil -i -s" from /tmp/aspersa -# ############################################################################## -parse_fusionmpt_lsiutil () { - echo - awk '/LSI.*Firmware/ { print " ", $0 }' /tmp/aspersa - grep . /tmp/aspersa | sed -n -e '/B___T___L/,$ {s/^/ /; p}' -} - -# ############################################################################## -# Parse the output of MegaCli64 -AdpAllInfo -aALL from /tmp/aspersa. -# ############################################################################## -parse_lsi_megaraid_adapter_info () { - name=$(awk -F: '/Product Name/{print substr($2, 2)}' /tmp/aspersa); - int=$(awk '/Host Interface/{print $4}' /tmp/aspersa); - prt=$(awk '/Number of Backend Port/{print $5}' /tmp/aspersa); - bbu=$(awk '/^BBU :/{print $3}' /tmp/aspersa); - mem=$(awk '/Memory Size/{print $4}' /tmp/aspersa); - vdr=$(awk '/Virtual Drives/{print $4}' /tmp/aspersa); - dvd=$(awk '/Degraded/{print $3}' /tmp/aspersa); - phy=$(awk '/^ Disks/{print $3}' /tmp/aspersa); - crd=$(awk '/Critical Disks/{print $4}' /tmp/aspersa); - fad=$(awk '/Failed Disks/{print $4}' /tmp/aspersa); - name_val Model "${name}, ${int} interface, ${prt} ports" - name_val Cache "${mem} Memory, BBU ${bbu}" -} - -# ############################################################################## -# Parse the output (saved in /tmp/aspersa) of -# /opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL -# ############################################################################## -parse_lsi_megaraid_bbu_status () { - charge=$(awk '/Relative State/{print $5}' /tmp/aspersa); - temp=$(awk '/^Temperature/{print $2}' /tmp/aspersa); - soh=$(awk '/isSOHGood:/{print $2}' /tmp/aspersa); - name_val BBU "${charge}% Charged, Temperature ${temp}C, isSOHGood=${soh}" -} - -# ############################################################################## -# Parse physical devices from the output (saved in /tmp/aspersa) of -# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL -# OR, it will also work with the output of -# /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL -# ############################################################################## -parse_lsi_megaraid_devices () { - echo - echo " PhysiclDev Type State Errors Vendor Model Size" - echo " ========== ==== ======= ====== ======= ============ ===========" - for dev in $(awk '/Device Id/{print $3}' /tmp/aspersa); do - sed -e '/./{H;$!d;}' -e "x;/Device Id: ${dev}/!d;" /tmp/aspersa \ - | awk ' - /Media Type/ {d=substr($0, index($0, ":") + 2)} - /PD Type/ {t=$3} - /Firmware state/ {s=$3} - /Media Error Count/ {me=$4} - /Other Error Count/ {oe=$4} - /Predictive Failure Count/ {pe=$4} - /Inquiry Data/ {v=$3; m=$4;} - /Raw Size/ {z=$3} - END { - printf(" %-10s %-4s %-7s %6s %-7s %-12s %-7s\n", - substr(d, 0, 10), t, s, me "/" oe "/" pe, v, m, z); - }' - done -} - -# ############################################################################## -# Parse virtual devices from the output (saved in /tmp/aspersa) of -# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL -# OR, it will also work with the output of -# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aAll -# ############################################################################## -parse_lsi_megaraid_virtual_devices () { - # Somewhere on the Internet, I found the following guide to understanding the - # RAID level, but I don't know the source anymore. - # Primary-0, Secondary-0, RAID Level Qualifier-0 = 0 - # Primary-1, Secondary-0, RAID Level Qualifier-0 = 1 - # Primary-5, Secondary-0, RAID Level Qualifier-3 = 5 - # Primary-1, Secondary-3, RAID Level Qualifier-0 = 10 - # I am not sure if this is always correct or not (it seems correct). The - # terminology MegaRAID uses is not clear to me, and isn't documented that I - # am aware of. Anyone who can clarify the above, please contact me. - echo - echo " VirtualDev Size RAID Level Disks SpnDpth Stripe Status Cache" - echo " ========== ========= ========== ===== ======= ====== ======= =========" - awk ' - /^Virtual Disk:/ { - device = $3; - devicenames[device] = device; - } - /Number Of Drives/ { - devices[device ",numdisks"] = substr($0, index($0, ":") + 1); - } - /^Name:/ { - devices[device ",name"] = $2 > "" ? $2 : "(no name)"; - } - /RAID Level/ { - devices[device ",primary"] = substr($3, index($3, "-") + 1, 1); - devices[device ",secondary"] = substr($4, index($4, "-") + 1, 1); - devices[device ",qualifier"] = substr($NF, index($NF, "-") + 1, 1); - } - /Span Depth/ { - devices[device ",spandepth"] = substr($2, index($2, ":") + 1); - } - /Number of Spans/ { - devices[device ",numspans"] = $4; - } - /^Size:/ { - devices[device ",size"] = substr($0, index($0, ":") + 1); - } - /^State:/ { - devices[device ",state"] = $2; - } - /^Stripe Size:/ { - devices[device ",stripe"] = $3; - } - /^Current Cache Policy/ { - devices[device ",wpolicy"] = $4 ~ /WriteBack/ ? "WB" : "WT"; - devices[device ",rpolicy"] = $5 ~ /ReadAheadNone/ ? "no RA" : "RA"; - } - END { - for ( device in devicenames ) { - raid = 0; - if ( devices[device ",primary"] == 1 ) { - raid = 1; - if ( devices[device ",secondary"] == 3 ) { - raid = 10; - } - } - else { - if ( devices[device ",primary"] == 5 ) { - raid = 5; - } - } - printf(" %-10s %-9s %-10s %5d %7s %6s %-7s %s\n", - device devices[device ",name"], - devices[device ",size"], - raid " (" devices[device ",primary"] "-" devices[device ",secondary"] "-" devices[device ",qualifier"] ")", - devices[device ",numdisks"], - devices[device ",spandepth"] "-" devices[device ",numspans"], - devices[device ",stripe"], devices[device ",state"], - devices[device ",wpolicy"] ", " devices[device ",rpolicy"]); - } - }' /tmp/aspersa -} - -# ############################################################################## -# Simplifies vmstat and aligns it nicely. We don't need the memory stats, the -# system activity is enough. -# ############################################################################## -format_vmstat () { - cat > /tmp/aspersa.awk <<-EOF - BEGIN { - format = " %2s %2s %4s %4s %5s %5s %6s %6s %3s %3s %3s %3s %3s\n"; - } - /procs/ { - print " procs ---swap-- -----io---- ---system---- --------cpu--------"; - } - /bo/ { - printf format, "r", "b", "si", "so", "bi", "bo", "ir", "cs", "us", "sy", "il", "wa", "st"; - } - \$0 !~ /r/ { - fuzzy_var = \$1; ${fuzzy_formula} r = fuzzy_var; - fuzzy_var = \$2; ${fuzzy_formula} b = fuzzy_var; - fuzzy_var = \$7; ${fuzzy_formula} si = fuzzy_var; - fuzzy_var = \$8; ${fuzzy_formula} so = fuzzy_var; - fuzzy_var = \$9; ${fuzzy_formula} bi = fuzzy_var; - fuzzy_var = \$10; ${fuzzy_formula} bo = fuzzy_var; - fuzzy_var = \$11; ${fuzzy_formula} ir = fuzzy_var; - fuzzy_var = \$12; ${fuzzy_formula} cs = fuzzy_var; - fuzzy_var = \$13; us = fuzzy_var; - fuzzy_var = \$14; sy = fuzzy_var; - fuzzy_var = \$15; il = fuzzy_var; - fuzzy_var = \$16; wa = fuzzy_var; - fuzzy_var = \$17; st = fuzzy_var; - printf format, r, b, si, so, bi, bo, ir, cs, us, sy, il, wa, st; - } - EOF - awk -f /tmp/aspersa.awk /tmp/aspersa - } - -# ############################################################################## -# The main() function is called at the end of the script. This makes it -# testable. Major bits of parsing are separated into functions for testability. -# As a general rule, we cannot 'cp' files from /proc, because they might be -# empty afterwards. (I've seen 'cp /proc/cpuinfo' create an empty file.) But -# 'cat' works okay. -# ############################################################################## -main () { - - # Begin by setting the $PATH to include some common locations that are not - # always in the $PATH, including the "sbin" locations, and some common - # locations for proprietary management software, such as RAID controllers. - export PATH="${PATH}:/usr/local/bin:/usr/bin:/bin:/usr/libexec" - export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" - export PATH="${PATH}:/usr/StorMan/:/opt/MegaRAID/MegaCli/"; - - # Set up temporary files. - temp_files "rm" - temp_files "touch" - section Aspersa_System_Summary_Report - - # ######################################################################## - # Grab a bunch of stuff and put it into temp files for later. - # ######################################################################## - sysctl -a > /tmp/aspersa.sysctl 2>/dev/null - - # ######################################################################## - # General date, time, load, etc - # ######################################################################## - platform="$(uname -s)" - name_val "Date" "`date -u +'%F %T UTC'` (local TZ: `date +'%Z %z'`)" - name_val "Hostname" "$(uname -n)" - name_val "Uptime" "$(uptime | awk '{print substr($0, index($0, "up") + 3)}')" - if which dmidecode > /dev/null 2>&1; then - vendor="$(dmidecode -s system-manufacturer 2>/dev/null | sed 's/ *$//g')" - if [ "${vendor}" ]; then - product="$(dmidecode -s system-product-name 2>/dev/null | sed 's/ *$//g')" - version="$(dmidecode -s system-version 2>/dev/null | sed 's/ *$//g')" - chassis="$(dmidecode -s chassis-type 2>/dev/null | sed 's/ *$//g')" - system="${vendor}; ${product}; v${version} (${chassis})" - name_val "System" "${system}"; - servicetag="$(dmidecode -s system-serial-number 2>/dev/null | sed 's/ *$//g')" - name_val "Service Tag" "${servicetag:-Not found}"; - fi - fi - name_val "Platform" "${platform}" - if [ "${platform}" = "SunOS" ]; then - if which zonename >/dev/null 2>&1 ; then - name_val "Zonename" "$(zonename)" - fi - fi - - # Try to find all sorts of different files that say what the release is. - if [ "${platform}" = "Linux" ]; then - kernel="$(uname -r)" - if [ -e /etc/fedora-release ]; then - release=$(cat /etc/fedora-release); - elif [ -e /etc/redhat-release ]; then - release=$(cat /etc/redhat-release); - elif [ -e /etc/system-release ]; then - release=$(cat /etc/system-release); - elif which lsb_release >/dev/null 2>&1; then - release="$(lsb_release -ds) ($(lsb_release -cs))" - elif [ -e /etc/lsb-release ]; then - release=$(grep DISTRIB_DESCRIPTION /etc/lsb-release |awk -F'=' '{print $2}' |sed 's#"##g'); - elif [ -e /etc/debian_version ]; then - release="Debian-based version $(cat /etc/debian_version)"; - if [ -e /etc/apt/sources.list ]; then - code=`cat /etc/apt/sources.list |awk '/^deb/ {print $3}' |awk -F/ '{print $1}'| awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -rn |head -n1 |awk '{print $2}'` - release="${release} (${code})" - fi - elif ls /etc/*release >/dev/null 2>&1; then - if grep -q DISTRIB_DESCRIPTION /etc/*release; then - release=$(grep DISTRIB_DESCRIPTION /etc/*release | head -n1); - else - release=$(cat /etc/*release | head -n1); - fi - fi - elif [ "${platform}" = "FreeBSD" ]; then - release="$(uname -r)" - kernel="$(sysctl -n kern.osrevision)" - elif [ "${platform}" = "SunOS" ]; then - release="$(head -n1 /etc/release)" - if [ -z "${release}" ]; then - release="$(uname -r)" - fi - kernel="$(uname -v)" - fi - name_val Release "${release}" - name_val Kernel "${kernel}" - - CPU_ARCH='32-bit' - OS_ARCH='32-bit' - if [ "${platform}" = "Linux" ]; then - if grep -q ' lm ' /proc/cpuinfo; then - CPU_ARCH='64-bit' - fi - elif [ "${platform}" = "FreeBSD" ]; then - if sysctl hw.machine_arch | grep -v 'i[36]86' >/dev/null; then - CPU_ARCH='64-bit' - fi - elif [ "${platform}" = "SunOS" ]; then - if isainfo -b | grep 64 >/dev/null ; then - CPU_ARCH="64-bit" - fi - fi - if file /bin/sh | grep '64-bit' >/dev/null; then - OS_ARCH='64-bit' - fi - name_val "Architecture" "CPU = $CPU_ARCH, OS = $OS_ARCH" - - # Threading library - if [ "${platform}" = "Linux" ]; then - name_val Threading "$(getconf GNU_LIBPTHREAD_VERSION)" - fi - if [ -x /lib/libc.so.6 ]; then - name_val "Compiler" "$(/lib/libc.so.6 | grep 'Compiled by' | cut -c13-)" - fi - - if [ "${platform}" = "Linux" ]; then - if getenforce >/dev/null 2>&1; then - getenforce="$(getenforce 2>&1)"; - fi - name_val "SELinux" "${getenforce:-No SELinux detected}"; - fi - - # We look in dmesg for virtualization information first, because it's often - # available to non-root users and usually has telltale signs. It's most - # reliable to look at /var/log/dmesg if possible. There are a number of - # other ways to find out if a system is virtualized. - cat /var/log/dmesg > /tmp/aspersa 2>/dev/null - if [ ! -s /tmp/aspersa ]; then - dmesg > /tmp/aspersa 2>/dev/null - fi - if [ -s /tmp/aspersa ]; then - virt="$(parse_virtualization_dmesg)" - fi - if [ -z "${virt}" ]; then - if which lspci >/dev/null 2>&1; then - lspci > /tmp/aspersa 2>/dev/null - if grep -qi virtualbox /tmp/aspersa; then - virt=VirtualBox - elif grep -qi vmware /tmp/aspersa; then - virt=VMWare - elif [ -e /proc/user_beancounters ]; then - virt="OpenVZ/Virtuozzo" - fi - fi - elif [ "${platform}" = "FreeBSD" ]; then - if ps -o stat | grep J ; then - virt="FreeBSD Jail" - fi - elif [ "${platform}" = "SunOS" ]; then - if which prtdiag >/dev/null 2>&1 && prtdiag > /tmp/aspersa.prtdiag 2>/dev/null; then - virt="$(parse_virtualization_generic /tmp/aspersa.prtdiag)" - elif which smbios >/dev/null 2>&1 && smbios > /tmp/aspersa.smbios 2>/dev/null; then - virt="$(parse_virtualization_generic /tmp/aspersa.smbios)" - fi - fi - name_val Virtualized "${virt:-No virtualization detected}" - # txlu 2011-08-30 add code for new hwaddr info - section HWaddr - for i in `ifconfig -s | cut -d' ' -f1 | grep -v Iface` - do - name_val $i `ifconfig $i | grep HWaddr | awk '{print $1,$5}' | cut -d' ' -f2` - name_val $i `ifconfig $i | grep addr | grep -v HWaddr | awk '{print $1,$5}' | cut -d' ' -f2` - done - # ######################################################################## - # Processor/CPU, Memory, Swappiness, dmidecode - # ######################################################################## - section Processor - if [ -f /proc/cpuinfo ]; then - cat /proc/cpuinfo > /tmp/aspersa 2>/dev/null - parse_proc_cpuinfo - elif [ "${platform}" = "FreeBSD" ]; then - parse_sysctl_cpu_freebsd /tmp/aspersa.sysctl - elif [ "${platform}" = "SunOS" ]; then - psrinfo -v > /tmp/aspersa - parse_psrinfo_cpus /tmp/aspersa - # TODO: prtconf -v actually prints the CPU model name etc. - fi - - section Memory - if [ "${platform}" = "Linux" ]; then - free -b > /tmp/aspersa - cat /proc/meminfo >> /tmp/aspersa - parse_free_minus_b /tmp/aspersa - elif [ "${platform}" = "FreeBSD" ]; then - parse_memory_sysctl_freebsd /tmp/aspersa.sysctl - elif [ "${platform}" = "SunOS" ]; then - name_val Memory "$(prtconf | awk -F: '/Memory/{print $2}')" - fi - - rss=$(ps -eo rss 2>/dev/null | awk '/[0-9]/{total += $1 * 1024} END {print total}') - name_val UsedRSS "$(shorten ${rss} 1)" - - if [ "${platform}" = "Linux" ]; then - name_val Swappiness "$(sysctl vm.swappiness 2>&1)" - name_val DirtyPolicy "$(sysctl vm.dirty_ratio 2>&1), $(sysctl vm.dirty_background_ratio 2>&1)" - if sysctl vm.dirty_bytes > /dev/null 2>&1; then - name_val DirtyStatus "$(sysctl vm.dirty_bytes 2>&1), $(sysctl vm.dirty_background_bytes 2>&1)" - fi - fi - - if which dmidecode >/dev/null 2>&1 && dmidecode > /tmp/aspersa 2>/dev/null; then - parse_dmidecode_mem_devices - fi - - # ######################################################################## - # Disks, RAID, Filesystems - # ######################################################################## - # TODO: Add info about software RAID - - if echo "${ASPERSA_SKIP}" | grep -v MOUNT >/dev/null; then - if [ "${platform}" != "SunOS" ]; then - section "Mounted_Filesystems" - cmd="df -h" - if [ "${platform}" = "Linux" ]; then - cmd="df -h -P" - fi - $cmd | sort > /tmp/aspersa2 - mount | sort | join /tmp/aspersa2 - > /tmp/aspersa - parse_filesystems /tmp/aspersa "${platform}" - fi - fi - - if [ "${platform}" = "Linux" ]; then - section "Disk_Schedulers_And_Queue_Size" - echo "" > /tmp/aspersa - for disk in $(ls /sys/block/ | grep -v -e ram -e loop -e 'fd[0-9]'); do - if [ -e "/sys/block/${disk}/queue/scheduler" ]; then - name_val "${disk}" "$(cat /sys/block/${disk}/queue/scheduler | grep -o '\[.*\]') $(cat /sys/block/${disk}/queue/nr_requests)" - fdisk -l "/dev/${disk}" >> /tmp/aspersa 2>/dev/null - fi - done - - # Relies on /tmp/aspersa having data from the Disk Schedulers loop. - section "Disk_Partioning" - parse_fdisk - - section "Kernel_Inode_State" - for file in dentry-state file-nr inode-nr; do - name_val "${file}" "$(cat /proc/sys/fs/${file} 2>&1)" - done - - section "LVM_Volumes" - - if which lvs >/dev/null 2>&1 && test -x "$(which lvs)"; then - lvs 2>&1 - else - echo "Cannot execute 'lvs'"; - fi - fi - - section "RAID_Controller" - - # ######################################################################## - # We look in lspci first because it's more reliable, then dmesg, because it's - # often available to non-root users. It's most reliable to look at - # /var/log/dmesg if possible. - # ######################################################################## - if which lspci >/dev/null 2>&1 && lspci > /tmp/aspersa 2>/dev/null; then - controller="$(parse_raid_controller_lspci)" - fi - if [ -z "${controller}" ]; then - cat /var/log/dmesg > /tmp/aspersa 2>/dev/null - if [ ! -s /tmp/aspersa ]; then - dmesg > /tmp/aspersa 2>/dev/null - fi - controller="$(parse_raid_controller_dmesg)" - fi - - name_val Controller "${controller:-No RAID controller detected}" - - # ######################################################################## - # Attempt to get, parse, and print RAID controller status from possibly - # proprietary management software. Any executables that are normally stored - # in a weird location, such as /usr/StorMan/arcconf, should have their - # location added to $PATH at the beginning of main(). - # ######################################################################## - notfound="" - if [ "${controller}" = "AACRAID" ]; then - if arcconf getconfig 1 > /tmp/aspersa 2>/dev/null; then - parse_arcconf - elif ! which arcconf >/dev/null 2>&1; then - notfound="e.g. http://www.adaptec.com/en-US/support/raid/scsi_raid/ASR-2120S/" - fi - elif [ "${controller}" = "HP Smart Array" ]; then - if hpacucli ctrl all show config > /tmp/aspersa 2>/dev/null; then - parse_hpacucli - elif ! which hpacucli >/dev/null 2>&1; then - notfound="your package repository or the manufacturer's website" - fi - elif [ "${controller}" = "LSI Logic MegaRAID SAS" ]; then - if MegaCli64 -AdpAllInfo -aALL -NoLog > /tmp/aspersa 2>/dev/null; then - parse_lsi_megaraid_adapter_info - elif ! which MegaCli64 >/dev/null 2>&1; then - notfound="your package repository or the manufacturer's website" - fi - if MegaCli64 -AdpBbuCmd -GetBbuStatus -aALL -NoLog > /tmp/aspersa 2>/dev/null; then - parse_lsi_megaraid_bbu_status - fi - if MegaCli64 -LdPdInfo -aALL -NoLog > /tmp/aspersa 2>/dev/null; then - parse_lsi_megaraid_virtual_devices - parse_lsi_megaraid_devices - fi - fi - - if [ "${notfound}" ]; then - echo " RAID controller software not found; try getting it from" - echo " ${notfound}" - fi - - if echo "${ASPERSA_SKIP}" | grep -v NETWORK >/dev/null; then - # ##################################################################### - # Network stuff - # ##################################################################### - if [ "${platform}" = "Linux" ]; then - section Network_Config - if which lspci > /dev/null 2>&1 && lspci > /tmp/aspersa 2>/dev/null; then - parse_ethernet_controller_lspci - fi - if sysctl net.ipv4.tcp_fin_timeout > /dev/null 2>&1; then - name_val "FIN Timeout" "$(sysctl net.ipv4.tcp_fin_timeout)" - name_val "Port Range" "$(sysctl net.ipv4.ip_local_port_range)" - fi - fi - - # TODO cat /proc/sys/net/ipv4/ip_conntrack_max ; it might be - # /proc/sys/net/netfilter/nf_conntrack_max or /proc/sys/net/nf_conntrack_max - # in new kernels like Fedora 12? - - if which ip >/dev/null 2>&1 && ip -s link > /tmp/aspersa 2>/dev/null; then - section Interface_Statistics - parse_ip_s_link /tmp/aspersa - fi - - if [ "${platform}" = "Linux" ]; then - section Network_Connections - if netstat -antp > /tmp/aspersa 2>/dev/null; then - parse_netstat - fi - fi - fi - - # ######################################################################## - # Processes, load, etc - # ######################################################################## - if echo "${ASPERSA_SKIP}" | grep -v PROCESS >/dev/null; then - section Top_Processes - if which prstat > /dev/null 2>&1; then - prstat | head - elif which top > /dev/null 2>&1 ; then - cmd="top -bn 1" - if [ "${platform}" = "FreeBSD" ]; then - cmd="top -b -d 1" - fi - $cmd | sed -e 's# *$##g' -e '/./{H;$!d;}' -e 'x;/PID/!d;' | grep . | head - fi - if which vmstat > /dev/null 2>&1 ; then - section "Simplified_and_fuzzy_rounded_vmstat_(wait_please)" - vmstat 1 5 > /tmp/aspersa - if [ "${platform}" = "Linux" ]; then - format_vmstat - else - # TODO: simplify/format for other platforms - cat /tmp/aspersa - fi - fi - fi - - # ######################################################################## - # All done. Signal the end so it's explicit. - # ######################################################################## - temp_files "rm" - temp_files "check" - section The_End -} - -# Execute the program if it was not included from another file. This makes it -# possible to include without executing, and thus test. -if [ "$(basename "$0")" = "summary" ] || [ "$(basename "$0")" = "bash" -a "$_" = "$0" ]; then - main $@ -fi diff --git a/other_shell/xsession.sh b/other_shell/xsession.sh deleted file mode 100755 index b5bd254..0000000 --- a/other_shell/xsession.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -rootfile="/root/.xsession-errors" -d5000file="/home/d5000/huadong/.xsession-errors" -if [ -f /home/d5000/huadong/.xsession-errors ];then - size=$(du -ms $file | cut -f 1) - if [ "$size" -gt 10 ]; then # If file is bigger than 10M - echo > $d5000file - fi -fi - -if [ -f /root/.xsession-errors ];then - rootsize=$(du -ms $file | cut -f 1) - if [ "$rootsize" -gt 10 ]; then # If file is bigger than 10M - echo > $rootfile - fi -fi diff --git a/pkg-install.sh b/pkg-install.sh deleted file mode 100755 index cd8ba93..0000000 --- a/pkg-install.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -#Install 32lib & tool packages -#PKGDIRS=(lib32/pkg_lib_i686 tool) -PKGDIRS=(lib32/pkg_lib_i686) - -install_pkg() { - pkg="$1" - pkgadd -f $pkg &>/dev/null - if [[ $? -ne 0 ]]; then - pkgadd -u -f $pkg &>/dev/null - echo "installing $pkg...." - echo "$pkg upgrade success." - else - echo "$pkg install success." - fi -} - -#uninstall_mysql() -#{ -# echo "Uninstall mysql ..." -# pkgrm mysql -# rm -rf /var/lib/mysql - -#} - -#uninstall mysql - -#(uninstall_mysql;mysql_install_db) - -pkgrm vixie-cron - -for dir in ${PKGDIRS[@]} -do - for pkg in `ls $dir` - do - install_pkg $dir/$pkg - done -done -install_pkg lib32/pango_i686_lib* -install_pkg lib32/gtk2_i686_lib* diff --git a/ssh_equivalence.sh b/ssh_equivalence.sh deleted file mode 100755 index e80b18d..0000000 --- a/ssh_equivalence.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash - -#Description : a script of ssh equivalence Setup -#notice: -#Author : Yejincheng -#Date: 2012/10/1 -#Email: jcye@linx-info.com - - -#Warning: -GET_PARAMETER=0 -function input_parameter_function() -{ - echo -e "\\033[1;32m" "$1" - read GET_PARAMETER - if [ -z ${GET_PARAMETER} ] - then - GET_PARAMETER="$2" - fi -} - -echo_fail() { - echo -e "\\033[1;31m" "fail" -} - -reset_color() { - echo -en "\\033[0;39m" -} - - -clear -echo -e "\\033[1;34m" "\n\n===该脚本在凝思磐石安全操作系统V4.2版本下完成ssh等效性设置===" -echo -e "\\033[1;34m" "\n\n===在需要设置ssh等效性的相关服务器和工作站的任1台凝思系统下,以root用户和d5000用户执行该脚本===" -echo -e "\\033[1;34m" "\n\n===注意:要求在所有相关服务器和工作站的/etc/hosts文件保持一致===" -echo -e "\\033[1;34m" "\n\n===注意:从而保证ssh等效性脚本运行成功后,以root或d5000用户,通过\"ssh 主机名\"访问时,不需要输入口令===" - -#创建本机、相关服务器和工作站的ssh密钥,并合成公钥文件 -echo -e "\\033[1;36m" "\n+++创建本机的ssh密钥,如已生成,按y进行覆盖,所有提示均直接按Enter键确认,并合成公钥文件+++\n" - -ssh-keygen -t rsa -cd ~/.ssh -cat id_rsa.pub>authorized_keys -COUNT=1 -while true - do - #设置ssh密钥 - echo -e "\\033[1;36m" "\n+++创建相关服务器和工作站的ssh密钥,如已生成,按y进行覆盖,所有提示均直接按Enter键确认,并合成公钥文件+++\n" - input_parameter_function "\n请输入相关服务器和工作站的主机名或ip地址(next,合成公钥文件结束,进入下一步,拷贝公钥):(缺省10.19.21.180)\n" "10.19.21.180" - - - IP_ADDRESS=${GET_PARAMETER} - - - if [ ${IP_ADDRESS} = "next" ] - then - break - fi - - ((COUNT++)) - echo -e "\\033[1;36m" "\n你输入的字符串是: ${IP_ADDRESS} ; 是第 ${COUNT} 台相关的服务器或工作站\n" - ssh ${IP_ADDRESS} ssh-keygen -t rsa - ssh ${IP_ADDRESS} cat .ssh/id_rsa.pub>>authorized_keys - done -COUNT=1 -while true - do - #拷贝合成的公钥文件 - echo -e "\\033[1;36m" "+++将合成的公钥文件拷贝到所有相关服务器和工作站系统下+++" - input_parameter_function "\n请输入相关服务器和工作站的主机名或ip地址(exit,拷贝公钥结束):(缺省10.19.21.180)\n" "10.19.21.180" - IP_ADDRESS=${GET_PARAMETER} - if [ ${IP_ADDRESS} = "exit" ] - then - break - fi - - ((COUNT++)) - echo -e "\\033[1;36m" "\n你输入的字符串是: ${IP_ADDRESS} ; 是第 ${COUNT} 台相关的服务器或工作站\n" - scp authorized_keys ${IP_ADDRESS}:.ssh - done - - -echo -e "\nssh等效性设置成功!\n" - -reset_color