2014-12-26

TCL, INFO exists

info exists 檢查變數是否存在.
例如 incr 指令的使用, 變數需先建立才能為變數進行加法運算. 此時可使用 info exists 先確認此變數是否存在, 再續程式.

if { ![ info exists counter ] } {
         set counter 0
} else {
         incr counter
}

TCL, File - Get file path

[Condition]
  • filename: test.tcl
  • file path: C:/02-MTS/99-Trainning/12-info/

set appPath [ file normalize [ info script ] ]

if { [file type $appPath ] == "link" } {
      set appPath [ file readlink $appPath ]
}

puts $appPath

[Program Output]
  • C:/02-MTS/99-Trainning/12-info/test.tcl

2014-12-10

Disable daemon of Smartd to speed up boot process.


What is Smartd: Smartd does hard drive reliability monitoring.


Turn it to OFF

Example OS: CentOS 4.2 with Kernel 2.6.9-22 EL
  • # chkconfig smartd --list
    • smartd    0:off   1:off   2:on   3:on   4:on   5:on   6:off
  • # chkconfig smartd off
  • # chkconfig smartd --list
    • smartd    0:off   1:off   2:off   3:off   4:off   5:off   6:off

2014-12-04