存档

‘linux’ 分类的存档

mark:现在douban.com 豆瓣挂了

2013年12月9日 1 条评论

2013-12-09 16:20 豆瓣down掉。

分类: linux, others 标签:

Code review 工具gerrit之体验

2013年9月17日 评论已被关闭

之前一直使用gitlab来管理代码,由于gitlab并没有强制code-review的功能,所以仓库管理员一直在找合适的工具进行Code-review,于是推荐给我gerrit,我从开始一直认为gerrit只是个code-review的辅助工具,必须跟gitlab整合起来使用,在不将二者捏到一块不罢休的理念下把二者的关系弄得越来越糊涂,用惯了gitlab总觉得gerrit太挫,于是前阵子果断放弃gerrit。
但是在仓库管理员的逼迫及公司对Code-review的迫切程度的驱使下,不得已又抽空看了看gerrit,目前看来gerrit本身就可以管理git,跟gitlab可以没有丝毫瓜葛。以下权且算是一份安装笔记,因为gerrit的具体如何使用还没真正搞明白。

安装环境:Centos6.4 + gerrit-2.6.1 + LDAP + mysql-5.1.69

Install gerrit
参考: http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/index.html
下载war
wget http://gerrit-releases.storage.googleapis.com/gerrit-2.6.1.war

初始化数据库
Install/config mysql
CREATE USER ‘gerrit’@’localhost’ IDENTIFIED BY ‘pwd’;
CREATE DATABASE reviewdb;
ALTER DATABASE reviewdb charset=utf8;
GRANT ALL ON reviewdb.* TO ‘gerrit’@’localhost’;
FLUSH PRIVILEGES;

创建用户
sudo adduser gerrit
sudo su gerrit
java -jar gerrit.war init -d /home/gerrit/gerritapp

init时mysql有个报错:
阅读全文…

分类: git, linux 标签: , ,

nginx lua as http client

2013年9月17日 评论已被关闭

首先感谢agentzh的辛苦大作,这里使用了openresty的版本。

1. 编译openresty


wget http://openresty.org/download/ngx_openresty-1.2.8.6.tar.gz
tar xzvf ngx_openresty-1.2.8.6.tar.gz
cd ngx_openresty-1.2.8.6/
./configure --with-luajit
make
make install

2.获取lua http client


git clone https://github.com/liseen/lua-resty-http

3. nginx vhost配置
阅读全文…

分类: linux, nginx 标签: ,

使Cacti流量图超过80M的解决方法

2013年4月3日 评论已被关闭

Before:

# /usr/local/rrdtool/bin/rrdtool info /var/www/html/rra/71/2995.rrd
ds[traffic_in].min = 0.0000000000e+00
ds[traffic_in].max = 1.0000000000e+07
ds[traffic_out].min = 0.0000000000e+00
ds[traffic_out].max = 1.0000000000e+07

阅读全文…

分类: linux 标签: ,

centos5.4升级网卡驱动

2013年1月4日 评论已被关闭

机器型号:Dell R710,操作系统Centos5.4,症状:流量大时网卡不通,日志无明显迹象。

解决办法,升级网卡驱动:

升级前:

[root@2hei.net]# ethtool -i eth0
driver: bnx2
version: 1.9.3
firmware-version: 5.2.3 NCSI 2.0.11
bus-info: 0000:01:00.0

步骤如下:

wget http://ftp.us.dell.com/network/Bcom_LAN_16.4.0_Linux_Source_A00.tar.gz

tar -zxvf Bcom_LAN_16.4.0_Linux_Source_A00.tar.gz
cd Bcom_LAN_16.4.0_Linux_Source_A00
cd NetXtremeII/
rpm -ivh netxtreme2-6.4.44-1.src.rpm

cd /usr/src/redhat/
rpmbuild -bb SPECS/netxtreme2.spec
rpm -ivh RPMS/x86_64/netxtreme2-6.4.44-1.x86_64.rpm

screen -R update_driver

vim upgrade.sh

#!/bin/bash

rmmod bnx2
depmod
modprobe bnx2

sh upgrade.sh &

升级后:

[root@2hei.net]#ethtool -i eth0
driver: bnx2
version: 2.1.6b
firmware-version: bc 3.5.12 ipms 1.6.0
bus-info: 0000:03:00.0

[root@2hei.net]#modinfo bnx2
filename: /lib/modules/2.6.18-164.el5/updates/bnx2.ko
version: 2.1.6b
license: GPL
description: Broadcom NetXtreme II BCM5706/5708/5709/5716 Driver

分类: linux 标签: ,

dmidecode ipmitool mcelog

2011年12月1日 评论已被关闭

Dmidecode:     
Type   Information
       —————————————-
          0   BIOS
          1   System
          2   Base Board
          3   Chassis
          4   Processor
          5   Memory Controller
          6   Memory Module
          7   Cache
          8   Port Connector
          9   System Slots
         10   On Board Devices
         11   OEM Strings
         12   System Configuration Options
         13   BIOS Language
         14   Group Associations
         15   System Event Log
         16   Physical Memory Array
         17   Memory Device
         18   32-bit Memory Error
         19   Memory Array Mapped Address
         20   Memory Device Mapped Address
         21   Built-in Pointing Device
         22   Portable Battery
         23   System Reset
         24   Hardware Security
         25   System Power Controls
         26   Voltage Probe
         27   Cooling Device
         28   Temperature Probe
         29   Electrical Current Probe
         30   Out-of-band Remote Access
         31   Boot Integrity Services
         32   System Boot
         33   64-bit Memory Error
         34   Management Device
         35   Management Device Component
         36   Management Device Threshold Data
         37   Memory Channel
         38   IPMI Device
         39   Power Supply
        
Instead of type_id, you can also pass the keyword to the -t option of the dmidecode command. Following are the available keywords.
       Keyword     Types
       ——————————
       bios        0, 13
       system      1, 12, 15, 23, 32
       baseboard   2, 10
       chassis     3
       processor   4
       memory      5, 6, 16, 17
       cache       7
       connector   8
       slot        9   

# dmidecode -t 16

#dmidecode -t 17
or
#dmidecode -t memory

[2hei.net]# ipmitool
No command provided!
Commands:
    raw           Send a RAW IPMI request and print response
    i2c           Send an I2C Master Write-Read command and print response
    spd           Print SPD info from remote I2C device
    lan           Configure LAN Channels
    chassis       Get chassis status and set power state
    power         Shortcut to chassis power commands
    event         Send pre-defined events to MC
    mc            Management Controller status and global enables
    sdr           Print Sensor Data Repository entries and readings
    sensor        Print detailed sensor information
    fru           Print built-in FRU and scan SDR for FRU locators
    gendev        Read/Write Device associated with Generic Device locators sdr
    sel           Print System Event Log (SEL)
    pef           Configure Platform Event Filtering (PEF)
    sol           Configure and connect IPMIv2.0 Serial-over-LAN
    tsol          Configure and connect with Tyan IPMIv1.5 Serial-over-LAN
    isol          Configure IPMIv1.5 Serial-over-LAN
    user          Configure Management Controller users
    channel       Configure Management Controller channels
    session       Print session information
    sunoem        OEM Commands for Sun servers
    kontronoem    OEM Commands for Kontron devices
    picmg         Run a PICMG/ATCA extended cmd
    fwum          Update IPMC using Kontron OEM Firmware Update Manager
    firewall      Configure Firmware Firewall
    shell         Launch interactive IPMI shell
    exec          Run list of commands from file
    set      &nb
sp;    Set runtime variable for shell and exec
    hpm           Update HPM components using PICMG HPM.1 file
    ekanalyzer    run FRU-Ekeying analyzer using FRU files
   
[2hei.net]# ipmitool event 3
Sending SAMPLE event: Memory – Correctable ECC
   0 | Pre-Init Time-stamp   | Memory #0x53 | Correctable ECC | Asserted
  
[2hei.net]# ipmitool sdr elist
CPU0 below Tmax  | 7Bh | ok  |  3.0 | 47 degrees C
CPU1 below Tmax  | 7Ah | ok  |  3.1 | 39 degrees C
DIMM0 Area(RT3)  | 7Eh | ok  |  7.0 | 30 degrees C
PCI Area(RT2)    | 7Fh | ok  |  7.0 | 36 degrees C
CPU0 VCORE       | 71h | ok  |  3.0 | 0.90 Volts

   
[2hei.net~]#mcelog –cpu nehalem –dmi < /var/log/mcelog >> /home/2hei.net/mcelog.dmi

CPU1 VCORE       | 70h | ok  |  3.1 | 1.02 Volts
3.3V             | 75h | ok  |  7.0 | 3.30 Volts
+12V             | 76h | ok  |  7.0 | 11.81 Volts
VBAT             | 79h | ok  |  7.0 | 3.12 Volts
5V               | 77h | ok  |  7.0 | 4.90 Volts
Sys.1(CPU 1)     | 80h | ns  |  7.0 | No Reading
Sys.2(CPU 0)     | 81h | ok  |  7.0 | 6720 RPM
Sys.3(Front 1)   | 82h | ok  |  7.0 | 4080 RPM
Sys.4(Front 2)   | 83h | ok  |  7.0 | 3840 RPM
Sys.5(Rear 1)    | 84h | ok  |  7.0 | 4200 RPM
Sys.6            | 85h | ns  |  7.0 | No Reading
Sys.7            | 86h | ns  |  7.0 | No Reading
Sys.8            | 87h | ns  |  7.0 | No Reading
Sys.9            | 88h | ns  |  7.0 | No Reading
Sys.10           | 89h | ns  |  7.0 | No Reading
 

Linux Keyboard shortcut keys

2011年10月21日 评论已被关闭

CTRL + C    Cancels the currently running command.
CTRL + D    Logs out of the current session.
CTRL + Z    Cancels current operation, moves back a directory or takes the current operation and moves it to the background.
CTRL + A    Moves the cursor to first character.
CTRL + E    Moves the cursor to last character.
CTRL + R    Search history command
CTRL + W    Deletes the last word typed in. For example, if you typed ‘mv file1 file2’ this shortcut would delete file2.
CTRL + U    Erases the complete line.
CTRL + P    Paste previous line(s). same as up
CTRL + B    Moves the cursor backward one character.
CTRL + F    Moves the cursor forward one character.
CTRL + H    Erase one character. Similar to pressing backspace.
CTRL + S    Stops all output on screen (XOFF).
CTRL + Q    Turns all output stopped on screen back on (XON).

分类: linux 标签:

nice linux

2011年9月15日 评论已被关闭
Just a mark:
nice -n 19 nice
19
sudo nice -n -20 nice
-20
————-
$man nice
NICE(1)                          User Commands                         NICE(1)
NAME
       nice – run a program with modified scheduling priority
SYNOPSIS
       nice [OPTION] [COMMAND [ARG]…]
DESCRIPTION
       Run  COMMAND  with an adjusted niceness, which affects process scheduling.  With no COMMAND, print the current nice-
       ness.  Nicenesses range from -20 (most favorable scheduling) to 19 (least favorable).
       -n, –adjustment=N
              add integer N to the niceness (default 10)
       –help display this help and exit
       –version
              output version information and exit
       NOTE: your shell may have its own version of nice, which usually supersedes  the  version  described  here.   Please
       refer to your shell?. documentation for details about the options it supports.
分类: linux 标签:

reset low speed USB device using ehci_hcd

2011年9月6日 评论已被关闭
dmesg has such logs:
usb 1-5.1: reset low speed USB device using ehci_hcd and address 4
usb 1-5.1: reset low speed USB device using ehci_hcd and address 4
usb 1-5.1: reset low speed USB device using ehci_hcd and address 4
usb 1-5.1: reset low speed USB device using ehci_hcd and address 4
usb 1-5.1: reset low speed USB device using ehci_hcd and address 4
usb 1-5.1: reset low speed USB device using ehci_hcd and address 4
usb 1-5.1: reset low speed USB device using ehci_hcd and address 4
# modprobe –help
modprobe: unrecognized option `–help’
Usage: modprobe [-v] [-V] [-C config-file] [-n] [-i] [-q] [-b] [-o <modname>] <modname> [parameters…]
modprobe -r [-n] [-i] [-v] <modulename> …
modprobe -l -t <dirname> [ -a <modulename> …]
#modprobe -r ehci_hcd
Sep  6 03:32:05 2hei.net kernel: usb 1-5.1: reset low speed USB device using ehci_hcd and address 4
Sep  6 03:33:44 2hei.net kernel: ehci_hcd 0000:00:1d.7: remove, state 1
Sep  6 03:33:44 2hei.net kernel: usb usb1: USB disconnect, address 1
Sep  6 03:33:44 2hei.net kernel: usb 1-5: USB disconnect, address 3
Sep  6 03:33:44 2hei.net kernel: usb 1-5.1: USB disconnect, address 4
Sep  6 03:33:44 2hei.net kernel: ehci_hcd 0000:00:1d.7: USB bus 1 deregistered
Sep  6 03:33:44 2hei.net kernel: ACPI: PCI interrupt for device 0000:00:1d.7 disabled
Sep  6 03:33:44 2hei.net kernel: usb 4-1: new full speed USB device using uhci_hcd and address 2
Sep  6 03:33:44 2hei.net kernel: usb 4-1: configuration #1 chosen from 1 choice
Sep  6 03:33:44 2hei.net kernel: hub 4-1:1.0: USB hub found
Sep  6 03:33:44 2hei.net kernel: hub 4-1:1.0: 3 ports detected
Sep  6 03:33:44 2hei.net kernel: usb 4-1.1: new full speed USB device using uhci_hcd and address 3
Sep  6 03:33:44 2hei.net kernel: usb 4-1.1: configuration #1 chosen from 1 choice
Sep  6 03:33:44 2hei.net kernel: input: American Megatrends Inc. Virtual Keyboard and Mouse as /class/input/input4
Sep  6 03:33:44 2hei.net kernel: input: USB HID v1.10 Keyboard [American Megatrends Inc. Virtual Keyboard and Mouse] on usb-0000:00:1d.2-1.1
Sep  6 03:33:44 2hei.net kernel: input: American Megatrends Inc. Virtual Keyboard and Mouse as /class/input/input5
Sep  6 03:33:44 2hei.net kernel: input: USB HID v1.10 Mouse [American Megatrends Inc. Virtual Keyboard and Mouse] on usb-0000:00:1d.2-1.1
分类: linux 标签:

Linux will keep /tmp files for 10 days by default

2011年8月3日 评论已被关闭

For files in /tmp directory, linux has cron at /etc/cron.daily to deal with:
[2hei.net cron.daily]$ cat tmpwatch
flags=-umc
/usr/sbin/tmpwatch “$flags” -x /tmp/.X11-unix -x /tmp/.XIM-unix \
    -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 240 /tmp
/usr/sbin/tmpwatch “$flags” 720 /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
    if [ -d “$d” ]; then
    /usr/sbin/tmpwatch “$flags” -f 720 “$d”
    fi
done

Linux will keep 10 days files in /tmp and 30 days in /var/tmp by default.

[2hei.net cron.daily]$ man tmpwatch
NAME
       tmpwatch – removes files which haven?. been accessed for a period of time

SYNOPSIS
       tmpwatch [-u|-m|-c] [-MUadfqstvx] [–verbose] [–force] [–all]
                      [–nodirs] [–nosymlinks] [–test] [–fuser] [–quiet]
                      [–atime|–mtime|–ctime] [–dirmtime] [–exclude <path>]
                      [–exclude-user <user>] <hours> <dirs>
OPTIONS
       -u, –atime
              Make the decision about deleting a file based on the file?. atime (access time). This is the default.

              Note that the periodic updatedb file system scans keep the atime of directories recent.

       -m, –mtime
              Make the decision about deleting a file based on the file?. mtime (modification time) instead of the atime.

       -c, –ctime
              Make the decision about deleting a file based on the file?. ctime (inode change time) instead of  the  atime;
              for directories, make the decision based on the mtime.

       -M, –dirmtime
              Make  the  decision  about deleting a directory based on the directory?. mtime (modification time) instead of
              the atime; completely ignore atime for directories.

       -a, –all
              Remove all file types, not just regular files, symbolic links and directories.

       -d, –nodirs
              Do not attempt to remove directories, even if they are empty.

       -d, –nosymlinks
              Do not attempt to remove symbolic links.

       -f, –force
              Remove files even if root doesn?. have write access (akin to rm -f).

       -q, –quiet
              Report only fatal errors.

       -s, –fuser
              Attempt to use the “fuser” command to see if a file is already open  before  removing  it.   Not  enabled  by
              default.    Does  help in some circumstances, but not all.  Dependent on fuser being installed in /sbin.  Not
              supported on HP-UX or Solaris.

       -t, –test
              Don?. remove files, but go through the motions of removing them. This implies -v.

       -U, –exclude-user=user
              Don?. remove files owned by user, which can be an user name or numeric user ID.

       -v, –verbose
              Print a verbose display. Two levels of verboseness are available — use this option twice  to  get  the  most
              verbose output.

       -x, –exclude=path
              Skip  path;  if  path  is a directory, all files contained in it are skipped too.  If path does not exist, it
              must be an absolute path that contains no symbolic links.

分类: linux 标签: