Warning: Undefined array key "cperpage" in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 255

Warning: Undefined variable $output in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 325

Warning: Undefined variable $fixed_tags in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 326

Warning: Undefined variable $isshowdots in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 327

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 330

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 333

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 336

Warning: Undefined variable $post in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 345

Warning: Attempt to read property "ID" on null in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 345

Warning: Undefined variable $post in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 345

Warning: Attempt to read property "ID" on null in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 345

Warning: Undefined variable $more_text_link in /www/wwwroot/www.now163.com/wp-content/themes/twentytwentyfive/functions.php on line 345
now163 – 第 3 页 – 理想社会

作者: now163

  • 为Ping记录加一个时间戳

    最近公司网络不稳定,间歇性断流。为了检查网络状况。我们需要用ping来了解网络状况(丢包等等一些问题)。
    ping的输出默认是不带时间戳的,所以很难定位故障时间。
    下面一个脚本很好的解决了此问题。
    代码另存为ping.vbs
    用法为:cscript ping.vbs 192.168.1.2 -t > ping.txt
    如果ping的输出是英文
    那么脚本里的
    re.Pattern=”^请求|^来自”
    替换为:
    re.Pattern=”^Reply|^Request”

    Dim args, flag, unsuccOut
    args=""
    otherout=""
    flag=0
    
    If WScript.Arguments.count = 0 Then
    WScript.Echo "Usage: cscript tping.vbs [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]"
    WScript.Echo "                         [-s count] [[-j host-list] | [-k host-list]]"
    WScript.Echo "                         [-r count] [-w timeout] destination-list"
    wscript.quit
    End if
    
    For i=0 to WScript.Arguments.count - 1
    args=args & " " & WScript.Arguments(i)
    Next
    
    Set shell = WScript.CreateObject("WScript.Shell")
    Set re=New RegExp
    re.Pattern="^请求|^来自"
    Set myping=shell.Exec("ping" & args)
    
    while Not myping.StdOut.AtEndOfStream
       strLine=myping.StdOut.ReadLine()
       r=re.Test(strLine)
       If r Then
    WScript.Echo date & " "& time & chr(9) & strLine
    flag=1
       Else
    unsuccOut=unsuccOut & strLine
       End if
    Wend
    
    if flag = 0 then
    WScript.Echo unsuccOut
    end if

    附上一个linux下的方法:

    ping baidu.com -c 10 | awk '{ print $0"\t" strftime("%H:%M:%S-%D",systime()) } '
  • linux命令行下查询自己的公网ip地址

    命令行下无法使用ip138.com进行查询肿么办?

    办法来了
    wget http://members.3322.org/dyndns/getip
    cat getip

  • 解决linux系统文件变只读

    一台IBM3650,因为其中一块硬盘损坏,导致系统出故障。开启需要fsck修复。

    fsck -y -f /var

    用了-f强行修复之后,可以顺利进入系统。但发现/var变为只读文件系统了。导致系统大部分应用都启动失败。

    [root@ox1 /]# rm /var/run/httpd.pid
    rm:是否删除 一般文件 “/var/run/httpd.pid”? y
    rm: 无法删除 “/var/run/httpd.pid”: 只读文件系统

    [root@ox1 ~]# df -h
    文件系统 容量 已用 可用 已用% 挂载点
    /dev/mapper/vg-slash 4.8G 1.1G 3.5G 24% /
    /dev/sda1 99M 26M 69M 28% /boot
    tmpfs 3.9G 0 3.9G 0% /dev/shm
    /dev/mapper/vg-home 757G 238G 481G 34% /home
    /dev/mapper/vg-tmp 1.9G 77M 1.8G 5% /tmp
    /dev/mapper/vg-usr 9.5G 2.8G 6.3G 31% /usr
    /dev/mapper/vg-pub 99G 11G 83G 12% /pub
    /dev/mapper/vg-var 9.5G 5.8G 3.3G 65% /var

    看来是系统将/var挂在为只读文件了。下面是解决办法。
    [root@ox1 /]#mkdir /home/varbackup
    [root@ox1 /]#mount –move /var /home/varbackup
    [root@ox1 /]#rm -rf /var
    [root@ox1 /]#cd /
    [root@ox1 /]#mkdir -p /pub/var
    [root@ox1 /]#ln -s /pub/var /var
    [root@ox1 /]#cp -a /home/varbackup/* /var/                 #这里一定要用-a参数,如果不把对应的文件权限也复制过去。那么会有很多应用启动失败。

    接下来修改该fstab:蓝色为注释掉。红色为新加的。

    [root@ox1 ~]# cat /etc/fstab
    /dev/vg/slash           /                       ext3    defaults        1 1
    LABEL=/boot             /boot                   ext3    defaults        1 2
    devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
    tmpfs                   /dev/shm                tmpfs   defaults        0 0
    /dev/vg/home            /home                   ext3    defaults,usrquota        1 2
    proc                    /proc                   proc    defaults        0 0
    sysfs                   /sys                    sysfs   defaults        0 0
    /dev/vg/tmp             /tmp                    ext3    defaults        1 2
    /dev/vg/usr             /usr                    ext3    defaults        1 2
    /dev/vg/swap            swap                    swap    defaults        0 0
    /dev/vg/pub             /pub            ext3    defaults        1 2
    #/dev/vg/var            /var            ext3    defaults        1 2
    /dev/vg/var             /home/varbackup ext3    defaults        1 2

    然后reboot重启,问题解决问题。

  • RHEL5.5 6.0 Xmanager连接

    RHEL5.5 Xmanager连接
    1,修改/usr/share/gdm/defaults.conf
    将五个参数按如下修改:
    Enable=true
    DisplaysPerHost=10
    Ports=177
    AllowRoot=true
    AllowRemoteRoot=true
    2,修改/etc/inittab文件

    #x:5:respawn:/etc/X11/prefdm -nodaemon #注销这句
    下面新增加一句
    x:5:respawn:/usr/sbin/gdm -nodaemon
    3,启起系统

    RHEL6.0 Xmanager连接
    1、修改/etc/gdm/custom.conf
    # GDM configuration storage
    [daemon]
    [security]
    [xdmcp]
    Enable=1 ———增加此行
    [greeter]
    [chooser]
    [debug]
    2,检查并关闭防火墙,或者增加一ACCETP;
    3,重启系统。

  • Ubuntu12.10 配置自动启动vnc

    1、安装x11vnc

    sudo apt-get install vino vinagre x11vnc

    2、设置远程桌面登录时使用的密码,设置完后直接回车确认保存密码到 ~/.vnc/passwd文件里,“~/ ”是你当前用户的根目录如:/home/xyz/

    sudo x11vnc -storepasswd

    3、设置x11vnc通用的密码存储位置

    sudo x11vnc -storepasswd in /etc/x11vnc.pass

    (更多…)

  • RHEL改用Centos源

    实验室购买的rhel订阅到期了。无法使用yum来解决依赖包问题,是个很头痛的事。

    逼不得已将rhel的源改为centos。

    1. 系统环境:RHEL 5
    2. 备份源文件#cp -a /etc/yum.repos.d/rhel-debuginfo.repo{,.bak}
    3. 创建CentOS-Base.repo 为如下内容: (更多…)
  • Cleanup Maildir Folders (Archive/delete Old Mails)

    Maildir is a huge improvement over mbox for storing local mails of users. Why? I will not go into a long explanation about this, because it is not the scope of this post, but just consider that saving each mail in its own file on the disk (Maildir) opposed to saving all mails in a single file (mbox) is much faster. Not only faster, but it is also much easier to manipulate the files (that are individual mails) on the system. For more details on maildir vs. mbox you can see http://www.courier-mta.org/mbox-vs-maildir/

    Now, even if Maildir is much faster for many emails kept on the server, when we reach a huge number of files in a single folder the access times to that folder will be considerably slower. Now I am not talking here about a couple of hundreds of mails, but some huge mailboxes with thousands of mails and huge sizes (over 3-5GB in size). You will be amazed that there are peoples that will do that… They are most probably using IMAP and keeping all their mails on the server, or even POP3 and saving one copy of each mail on the server. (更多…)

  • AIX平台NFS配置

    AIX平台NFS配置

    1、 Nfs依赖的2种协议,包括表示层的XDR(external data representation 外部数据表示)和会话层的RPC(remote procedure call远程过程调用)。

    2、 nfs守候进程和它们的子系统

    22840716_1334289320UUFS

     

     

     

     

    3、2和3成对完成预读后写功能。保证系统响应速度。

    4、4和5配对,完成文件锁定功能。 (更多…)

  • Samba配置文件常用参数详解

    Samba配置文件常用参数详解
    Samba的主配置文件叫smb.conf,默认在/etc/samba/目录下。
    smb.conf含有多个段,每个段由段名开始,直到下个段名。每个段名放在方括号中间。每段的参数的格式是:名称=指。配置文件中一行一个段名和参数,段名和参数名不分大小写。
    除了[global]段外,所有的段都可以看作是一个共享资源。段名是该共享资源的名字,段里的参数是该共享资源的属性。
    Samba安装好后,使用testparm命令可以测试smb.conf配置是否正确。使用testparm –v命令可以详细的列出smb.conf支持的配置参数。
    全局参数:
    ==================Global Settings ===================
    [global]
    config file = /usr/local/samba/lib/smb.conf.%m (更多…)
  • sendmail 文件 virtusertable 管理虚拟域

    如同Apache一样,sendmail也允许使用虚拟主机功能,这是通过FEATURE(virtusertable)功能实现的,而虚拟主机的文件缺省是/etc/mail/virtusertable。这个文件的形式类似于aliases文件,即:左地址 右地址 ,中间用Tab键分开。还需要注意的是,虚拟域(左地址的域名),应该属于本机接收之列。

    joe@yourdomain.com    jschmoe                         1

    bogus@yourdomain.com  error:nouser No such user here  2

    @testdomain.com       test@mydomain.com               3

    @yourdomain.com       %1@othercompany.com             4 (更多…)