2015-12-25

Dreamplug, IF IP GONE.

Create a network config file manually.
# vi /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

auto eth1
iface eth1 inet static
address 192.168.2.1
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255

# /sbin/ifup -a
Note-01:
# ifup -h

BusyBox v1.16.1 (2015-12-03 19:06:58 CST) multi-call binary.

Usage: ifup [-ainmvf] IFACE...

Options:
        -a      De/configure all interfaces automatically
        -i FILE Use FILE for interface definitions
        -n      Print out what would happen, but don't do it
                (note: doesn't disable mappings)
        -m      Don't run any mappings
        -v      Print out what would happen before doing it
        -f      Force de/configuration

Note-02: When "ifup -a" and get below message, try this

ifup: interface lo already configured
ifup: interface eth0 already configured
ifup: interface eth1 already configured

# ifdown -a
# ifup -a

2015-12-23

Dreamplug, uDHCPd options

File: /etc/udhcpd.conf
# Sample udhcpd configuration file (/etc/udhcpd.conf)
# Values shown are defaults

# The start and end of the IP lease block
start  192.168.0.20
end  192.168.0.254

# The interface that udhcpd will use
interface eth0

Dreamplug, DHCP server



2015-08-17

TCL, MAC remove ":", and call back ":".

Example MAC is 001122998877
Change example MAC to 00:11:22:99:88:77

set macEth0 "001122998877"

for { set i 0 } {$i < 6 } { incr i } {
      set temp [format "%s" [string range $macEth0 [expr $i * 2] [expr $i * 2 + 1]]]
      append macEth0 "$temp"
      if { $i == 5 } { break }
      append macEth0 ":"
}

puts "Debug: macEth0 ==> $macEth0"


Remove MAC symbol ":"

set var_mac ""
set sfis_macEth1 ""

set var_mac [string map {: ""} $macEth0]
set sfis_macEth1 [string map {: ""} $macEth1]

puts "var_mac = $var_mac"
puts "sfis_macEth1 = $sfis_macEth1"

2015-05-08

SED

sed --> stream editor

原有文件: test.file
文件內容:
  • this is line 1 on original test.file!
  • this is line 2 on original test.file!!
  • this is line 3 on original test.file!!!
刪除第三行
    • # sed -i "3d' test.file
    • # cat test.file
      • this is line 1 on original test.file!
      • this is line 2 on original test.file!!
Parameter
  • d ==> 刪除指定行號
  • c\<字串> ==> 以 <字串> 取代指定的行號
  • a\<字串> ==> 在指定的行號後新增一行 <字串>
  • a lot of parameters.

2015-04-24

ECHO

  • Parameter
    • -n : 不要在最後自動換行
    • -e : 若字串中出現以下字元, 則特別加已處理, 而不將之當成一般文字輸出.
      • \a : 發出警告聲
      • \n : 刪除前一個字元
      • \c : 最後不加上換行符號
      • \f : 換行且游標停留在原來位置
      • \n : 換行且游標移至行首
      • \r : 游標移至行首, 但不換行
      • \t : 插入 tab
      • \v : 與 \f 相同
      • \\ : 插入 \ 字元
      • \nnn : 插入 nnn (八進位) 所代表的 ASCII字元
Example

2015-04-02

SVN, first try.


Installation & Setup
  • # yum install mod_dav_svn subversion
  • # vim /etc/httpd/conf.d/subversion.conf
    • make sure 2 lines upper this config file.
      • LoadModule dav_svn_module     modules/mod_dav_svn.so
      • LoadModule authz_svn_module   modules/mod_authz_svn.so
    • modify these
      • <Location /repos>                                  # root path for http connection on /svn
        • DAV svn                                      # svn = connection method
        • SVNPath /var/www/svn/repos     # local svn path
        • AuthType Basic                            # 
        • AuthName "Subversion repos"     # show login information
        • AuthUserFile /etc/svn-auth-conf   # account & password  located file
        • Require valid-user                          # svn login required password
        • #Satisfy Any                                   # svn login password no required
      • </Location>
Create first user
  • # htpasswd -cm /etc/svn-auth-conf yourusername
Create other users
  • # htpasswd -m /etc/svn-auth-conf anotherusername 
Establish version control area
  • # mkdir /var/www/svn
  • # cd /var/www/svn
  • # svnadmin create mts
  • # chown -R apache.apache mts
  • # service httpd restart