AIX 操作

日常使用(做记录,以便查询):    操作系统篇 

1、查询对应目录的大小

du -hs /usr/local

 

------------------------------------------------------

2Linux 网卡配置命令

 

ifconfig eth0 192.168.1.123 netmask 255.255.255.0 getway 192.168.1.1 up

 

-------------------------------------------------------

3、清除日志的命令

echo > listener.log

 

-------------------------------------------------------

4、删除7天以前的"*.dbf"文件

find /usr/local/oracle/backup/ -xdev -mtime +7 -name "*.dbf" |xargs rm -rf

 

-------------------------------------------------------

5、打开端口并查看命令

nc -lp 23 &(打开23端口,即telnet

 

netstat -an | grep :23 (查看是否打开23端口)

 

-------------------------------------------------------

6#openssh安装脚本

 

#!/bin/bash

/etc/rc.d/init.d/sshd stop

tar xvfz openssh-5.3p1.tar.gz

cd /root/openssh-5.3p1

./configure --prefix=/usr --with-pam --with-md5-passwords --sysconfdir=/etc/ssh

make

make install

/etc/rc.d/init.d/sshd start

 

-------------------------------------------------------

7、当使用df -h时显示乱码时,修改如下文件为如下内容即可

vi /etc/sysconfig/i18n

LANG="zh_CN.GB18030"

 

 

-------------------------------------------------------

8、怎样更改主机名

 

第一步:

#hostname oratest

第二步:

修改/etc/sysconfig/network中的hostname

第三步:

修改/etc/hosts文件

 

-------------------------------------------------------

9、查询系统开放的端口和对应进程

 

Linux:

netstat -anp|grep LISTEN

 

Windows:

netstat -anbv -p tcp > temp.txt

 

-------------------------------------------------------

10HP UNIX硬件信息查询

/opt/ignite/bin/print_manifest

ioscan

machinfo

 

-------------------------------------------------------

11HP UNIX系统参数修改

使用sam命令(System Administartion Manager

进入Kernal Configuration后进入Tunables修改

 

-------------------------------------------------------

12Mount参数的使用

Mounting NFS Filesystems handle

mount shadowman.example.com:/misc/export /misc/local

 

Mounting NFS Filesystems using /etc/fstab

server:/usr/local/pub    /pub   nfs    rsize=8192,wsize=8192,timeo=14,intr

 

Mounting samba

mount -t smbfs -o username=bcinfo,password=bcinfonet //10.25.59.156/bak /usr/local/bcinfo/ivr_bak

 

-------------------------------------------------------

13、双网卡绑定脚本

 

#!/bin/bash

I1='eth0'

I2='eth1'

I3='bond0'

#save config an temp files

cat /dev/null > /tmp/IP

cat /dev/null > /tmp/MAC1

cat /dev/null > /tmp/MAC2

grep IPADDR /etc/sysconfig/network-scripts/ifcfg-$I1 > /tmp/IP

grep NETMASK /etc/sysconfig/network-scripts/ifcfg-$I1 >> /tmp/IP

grep GATEWAY /etc/sysconfig/network-scripts/ifcfg-$I1 >> /tmp/IP

grep HWADDR /etc/sysconfig/network-scripts/ifcfg-$I1 > /tmp/MAC1

grep HWADDR /etc/sysconfig/network-scripts/ifcfg-$I2 > /tmp/MAC2

 

#config interface

#interface1

echo "DEVICE=eth0" > /etc/sysconfig/network-scripts/ifcfg-$I1

echo "USERCTL=no" >> /etc/sysconfig/network-scripts/ifcfg-$I1

echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/ifcfg-$I1

echo "MASTER=bond0" >> /etc/sysconfig/network-scripts/ifcfg-$I1

echo "SLAVE=yes" >> /etc/sysconfig/network-scripts/ifcfg-$I1

echo "BOOTPROTO=none" >> /etc/sysconfig/network-scripts/ifcfg-$I1

grep HWADDR /tmp/MAC1 >>/etc/sysconfig/network-scripts/ifcfg-$I1

#interface2

echo "DEVICE=eth1" > /etc/sysconfig/network-scripts/ifcfg-$I2

echo "USERCTL=no" >> /etc/sysconfig/network-scripts/ifcfg-$I2

echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/ifcfg-$I2

echo "MASTER=bond0" >> /etc/sysconfig/network-scripts/ifcfg-$I2

echo "SLAVE=yes" >> /etc/sysconfig/network-scripts/ifcfg-$I2

echo "BOOTPROTO=none" >> /etc/sysconfig/network-scripts/ifcfg-$I2

grep HWADDR /tmp/MAC2 >>/etc/sysconfig/network-scripts/ifcfg-$I2

#interface3

echo "DEVICE=bond0" > /etc/sysconfig/network-scripts/ifcfg-$I3

echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/ifcfg-$I3

echo "BOOTPROTO=none" >> /etc/sysconfig/network-scripts/ifcfg-$I3

grep IPADDR /tmp/IP >> /etc/sysconfig/network-scripts/ifcfg-$I3

grep NETMASK /tmp/IP >> /etc/sysconfig/network-scripts/ifcfg-$I3

grep GATEWAY /tmp/IP >> /etc/sysconfig/network-scripts/ifcfg-$I3

 

#modify modprode

echo "alias bond0 bonding" >> /etc/modprobe.conf

echo "options bond0 miimon=100 mode=1" >> /etc/modprobe.conf

 

#reboot system

echo "Now waiting for reboot system"

reboot

 

-------------------------------------------------------

14Lifekeeper切换服务器

/opt/LifeKeeper/bin/perform_action -t oracle -a restore

 

-------------------------------------------------------

15、建虚拟网卡,直接打以下指令完成:

 

ifconfig eth0:0 10.0.0.1 up

 

-------------------------------------------------------

16、查CPU内核数

cat /proc/cpuinfo |grep "model name" && cat /proc/cpuinfo |grep "physical id"

 

-------------------------------------------------------

17、查主板信息

dmidecode

 

-------------------------------------------------------

18、自动打包文件后上传到FTP

#!/bin/bash

tar cvfz ums10.25.105.56_backup.tar.gz ./ums20100309.dmp ./ums20100309.log

ftp -n 10.25.105.51 <<EOF

user bcinfo bcinfo2010

pro

bin

put ums10.25.105.56_backup.tar.gz

quit

EOF

exit 0

 

-------------------------------------------------------

19Veritas 增加磁盘卷空间操作过程

 

--查看磁盘分区信息

fdisk -l

--查看vx磁盘分区状态

vxdisk list

--查看vx磁盘组信息

vxdg list

--设置RHEL的系统参数,设置这些参数后系统才能找到相应的硬件

echo "1" > /sys/class/fc_host/host0/issue_lip

echo "1" > /sys/class/fc_host/host1/issue_lip

echo "- - -" > /sys/class/scsi_host/host0/scan

echo "- - -" > /sys/class/scsi_host/host1/scan

--设置vx卷管理为允许

vxdctl enable

--扫描新的vx磁盘分区

vxdisk scandisks

--查看vx路径     

vxdisk path

--查看所有vx卷的信息

vxdisk -o alldgs list

--查看vx卷信息

vxprint -hrt|more

vxprint -v

--查看vx卷的最大可用空间

vxassist -g datadg maxsize

--手动删除分区(多个)

vxdg -g datadg rmdisk datadg17=ibm_ds8x000_00a4 datadg18=ibm_ds8x000_01a4 datadg19=ibm_ds8x000_02a4 datadg20=ibm_ds8x000_03a4 datadg21=ibm_ds8x000_04a4 datadg22=ibm_ds8x000_05a4 datadg23=ibm_ds8x000_06a4 datadg24=ibm_ds8x000_07a4

vxprint -hrt

--手动增加分区(多个)

vxdg -g datadg adddisk datadg17=ibm_ds8x000_00a4 datadg18=ibm_ds8x000_01a4 datadg19=ibm_ds8x000_02a4 datadg20=ibm_ds8x000_03a4 datadg21=ibm_ds8x000_04a4 datadg22=ibm_ds8x000_05a4 datadg23=ibm_ds8x000_06a4 datadg24=ibm_ds8x000_07a4

vxprint -hrt

--??

vxassist -g datadg maxsize

--查看License

vxlicrep

--为卷datadg lv_data增加相应的大小

vxresize -g datadg lv_data +1096000m

--查看增加后的情况

vxassist -g datadg maxsize

vxprint -hrt

vxdisk list

-------------------------------------------------------

20、测试HP服务器的ilo接口是否正常启动

 

fence_ilo -a 192.192.1.48 -l bcinfo -p bcinfo2009 -o status

 

-------------------------------------------------------

21Cluster GFS停止顺序

umount  /data

service rgmanager stop

service gfs2 stop

service clvmd stop

service cman stop

 

--Cluster GFS启动顺序

service cman start

service clvmd start

service gfs2 start

service rgmanager start

mount -t gfs2 /dev/gfsvg01/gfslv01 /data

 

-------------------------------------------------------

22、打开路由转发功能

echo 1 >/proc/sys/net/ipv4/ip_forward

vi /etc/sysctl.conf

-------------------------------------------------------

23、防火墙策略举例

export OPENVPN_IFACE="tun0"

export OPENVPN_IP_RANGE="172.39.0.0/24"

export LAN_IP="10.25.71.37"

export LAN_IFACE="bond0"

iptables -A INPUT -i $OPENVPN_IFACE -j ACCEPT

iptables -A FORWARD -i $OPENVPN_IFACE -j ACCEPT

iptables -t nat -A POSTROUTING -s $OPENVPN_IP_RANGE -o $LAN_IFACE -j SNAT --to $LAN_IP

 

 

-------------------------------------------------------

24、同步时间脚本

vi /usr/bin/up_time.sh

 

######################################

#

# synchronous timing

#

######################################

#

# Created by LiaoYongjian 2010-05-25

# Make use of root

##

#filename:/usr/bin/up_time.sh

##

##

 

/usr/sbin/ntpdate 10.25.70.1

/sbin/hwclock -w

************************************************************

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值