2011-03-03

プロフェッショナルの原点

プロフェッショナルの原点 引用:Amazon

組織に働く人たちが、時間管理・集中の方法・強みの鍛え方・意思決定の仕方など、みずからを磨き、限られた時間の中で最大の成果をあげるための必須のノウハウを、ドラッカーの言葉をもとにまとめた仕事論の王道。
本書を読めば、一流の仕事ができるようになるための姿勢と具体的な行動がわかる。ドラッカー自身がほぼ一世紀にわたる知的人生の中で育み、実践してきた方法であり、長い時の流れにも耐えてきた不変の原理原則である。

2011-03-02

京都老舗―暖簾のこころ

京都老舗―暖簾のこころ 引用:Amazon

「伝統とは変わり続けること」百年あるいは数百年、京都という土地に根付き、愛され続けている老舗三十六店。お店の歴史は人の歴史、時代の投手たちは何を考え、何を伝えてきたのか。前作『京都職人 匠のてのひら』では技術継承の難しさ同じ仕事を継続していくことの大変さを、シリーズ最新刊の本書では暖簾を守る事の難しさ、伝統を伝えていくことの大変さを書き記しました。三十六店、三十六様の「言葉」を読み終えたとき「京都」と「老舗」に対するイメージに新しいものが加わるはずです。
雨森敬太郎薬房/市原平兵衛商店/一文字屋和助/いづ萬老舗/いもぼう平野屋本店/芸艸堂/帯屋捨松/本家尾張屋/かづら清老舗/かま八老舗/紙司柿本 /御ちまき司川端道喜/菊一文字/鳩居堂/彩雲堂/佐々木竹苞書楼/渋新老舗/清課堂/大市/高橋堤燈/高室畳工業所/玉乃光酒造/たる源/通圓/なり田/原了郭 /柊屋/堀金箔粉/本田味噌/松野醤油/三嶋亭/みなとや幽霊子育飴本舗/村山造酢/香樹園八百林/山中油店/湯波吉

2011-03-01

京都職人―匠のてのひら

京都職人―匠のてのひら 引用:Amazon

京都の類い希なる「ものづくり」の世界。
消えゆく技術、新たな挑戦──。「能面」「花かんざし」「手摺りカルタ」など京都の伝統工芸をいまに伝える職人50人の「技」と「半生」。
美麗な写真とともに綴る「職人の世界」。
浅田晶久「京瓦」/綾部之「京の木工芸」/石田章一「竹工芸」/磯田達也「蒔絵」/今井義延「京刃物」/岩井彩「能面」/植田勝也「京足袋」/大塚華仙「截金」/大林芳雄「京組紐」/岡崎昭「表装」/鍵谷恭三「房・よりひも」/片岡喜三郎「邦楽器絃」/金谷雅明「京扇子」/河添功「京無地染」/川橋吉春「旗印染」/川本和代「京鹿の子絞り」/木野高利「京丸うちわ」/小泉景「京印章」/小糸敏夫「型友禅」/小嶋豊一「京提灯」/小松二三三「京繍」/佐竹利治「西陣織」/定永光夫「花かんざし」/澤田義春「色紙・短冊」/柴田勘十郎「京弓」/鈴木セツ子「水引細工」/高橋和男「京象嵌」/竹内伸一「黄楊櫛」/田中實「京すだれ」/谷川清三「キセル」/谷野修子「京唐紙」/丹治潔「和ろうそく」/辻賢一「金網細工」/中川利春「京銘竹」/西堀耕太郎「京和傘」/西村金造・大造「京石工芸品」/長谷川淳一「杼」/林利孝「京黒紋付染」/前澤さとえ「京念珠」/松井重夫「手刷りカルタ」/村田定平「数寄屋金具」/八木聖二「茶筒」/矢澤幹子「七宝」/安井文彦「和本」/山崎貞一「京仏具」山下雄治「調べ緒」/山本八郎・晃久「神鏡」/和田伊三男「京真田紐」/松栄堂「薫香」
対談「世界一のものづくりの街、京都」叶松谷×大野木啓人

2011-02-02

Tokyo Tyrant ttexpire.lua

function expire()
   local args = {}
   local cdate = string.format("%d", _time())
   table.insert(args, "addcond\0x\0NUMLE\0" .. cdate)
   table.insert(args, "out")
   local res = _misc("search", args)
   if not res then
      _log("expiration was failed", 2)
   end
   print("rnum=" .. _rnum() .. "  size=" .. _size())
end

Tokyo Tyrant 起動スクリプト スレーブ

#! /bin/sh
# chkconfig: 345 65 55
# description: Startup script for the server of Tokyo Tyrant For Session
# processname: tokyotyrant

#----------------------------------------------------------------
# Startup script for the server of Tokyo Tyrant
#----------------------------------------------------------------


# configuration variables
prog="ttservctl"
cmd="ttserver"
basedir="/home/ttserver/data"
port="1978"
pidfile="$basedir/ttserver.pid"
logfile="$basedir/ttserver.log"
ulogdir="$basedir/ulog"
ulimsiz="256m"
sid=2
mhost="remotehost1"
mport="1978"
rtsfile="$basedir/ttserver.rts"
dbname="$basedir/session.tct#bnum=1000000#idx=x:dec#dfunit=8"
ext="/home/ttserver/ext/ttexpire.lua"
extpc="expire 1"
maxcon="65535"
retval=0


# setting environment variables
LANG=C
LC_ALL=C
PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/tokyotyrant/bin"
export LANG LC_ALL PATH


# start the server
start(){
  printf 'Starting the server of Tokyo Tyrant\n'
  mkdir -p "$basedir"
  if [ -z "$basedir" ] || [ -z "$port" ] || [ -z "$pidfile" ] || [ -z "$dbname" ] ; then
    printf 'Invalid configuration\n'
    retval=1
  elif ! [ -d "$basedir" ] ; then
    printf 'No such directory: %s\n' "$basedir"
    retval=1
  elif [ -f "$pidfile" ] ; then
    pid=`cat "$pidfile"`
    printf 'Existing process: %d\n' "$pid"
    retval=1
  else
    if [ -n "$maxcon" ] ; then
      ulimit -n "$maxcon" >/dev/null 2>&1
    fi
    cmd="$cmd -port $port -dmn -pid $pidfile"
    if [ -n "$logfile" ] ; then
      cmd="$cmd -log $logfile"
    fi
    if [ -n "$ulogdir" ] ; then
      mkdir -p "$ulogdir"
      cmd="$cmd -ulog $ulogdir"
    fi
    if [ -n "$ulimsiz" ] ; then
      cmd="$cmd -ulim $ulimsiz"
    fi
    if [ -n "$sid" ] ; then
      cmd="$cmd -sid $sid"
    fi
    if [ -n "$mhost" ] ; then
      cmd="$cmd -mhost $mhost"
    fi
    if [ -n "$mport" ] ; then
      cmd="$cmd -mport $mport"
    fi
    if [ -n "$rtsfile" ] ; then
      cmd="$cmd -rts $rtsfile"
    fi
    if [ -n "$ext" ] ; then
      cmd="$cmd -ext $ext"
    fi
    if [ -n "$extpc" ] ; then
      cmd="$cmd -extpc $extpc"
    fi
    printf "Executing: %s\n" "$cmd"
    cmd="$cmd $dbname"
    $cmd
    if [ "$?" -eq 0 ] ; then
      printf 'Done\n'
    else
      printf 'The server could not started\n'
      retval=1
    fi
  fi
}


# stop the server
stop(){
  printf 'Stopping the server of Tokyo Tyrant\n'
  if [ -f "$pidfile" ] ; then
    pid=`cat "$pidfile"`
    printf "Sending the terminal signal to the process: %s\n" "$pid"
    kill -TERM "$pid"
    c=0
    while true ; do
      sleep 0.1
      if [ -f "$pidfile" ] ; then
        c=`expr $c + 1`
        if [ "$c" -ge 100 ] ; then
          printf 'Hanging process: %d\n' "$pid"
          retval=1
          break
        fi
      else
        printf 'Done\n'
        break
      fi
    done
  else
    printf 'No process found\n'
    retval=1
  fi
}


# send HUP to the server for log rotation
hup(){
  printf 'Sending HUP signal to the server of Tokyo Tyrant\n'
  if [ -f "$pidfile" ] ; then
    pid=`cat "$pidfile"`
    printf "Sending the hangup signal to the process: %s\n" "$pid"
    kill -HUP "$pid"
    printf 'Done\n'
  else
    printf 'No process found\n'
    retval=1
  fi
}


# check permission
if [ -d "$basedir" ] && ! touch "$basedir/$$" >/dev/null 2>&1
then
  printf 'Permission denied\n'
  exit 1
fi
rm -f "$basedir/$$"


# dispatch the command
case "$1" in
start)
  start
  ;;
stop)
  stop
  ;;
restart)
  stop
  start
  ;;
hup)
  hup
  ;;
*)
  printf 'Usage: %s {start|stop|restart|hup}\n' "$prog"
  exit 1
  ;;
esac


# exit
exit "$retval"



# END OF FILE

Tokyo Tyrant 起動スクリプト マスタ

#! /bin/sh
# chkconfig: 345 65 55
# description: Startup script for the server of Tokyo Tyrant For Session
# processname: tokyotyrant

#----------------------------------------------------------------
# Startup script for the server of Tokyo Tyrant
#----------------------------------------------------------------


# configuration variables
prog="ttservctl"
cmd="ttserver"
basedir="/home/ttserver/data"
port="1978"
pidfile="$basedir/ttserver.pid"
logfile="$basedir/ttserver.log"
ulogdir="$basedir/ulog"
ulimsiz="256m"
sid=1
mhost="remotehost2"
mport="1978"
rtsfile="$basedir/ttserver.rts"
dbname="$basedir/session.tct#bnum=1000000#idx=x:dec#dfunit=8"
ext="/home/ttserver/ext/ttexpire.lua"
extpc="expire 1"
maxcon="65535"
retval=0


# setting environment variables
LANG=C
LC_ALL=C
PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/tokyotyrant/bin"
export LANG LC_ALL PATH


# start the server
start(){
  printf 'Starting the server of Tokyo Tyrant\n'
  mkdir -p "$basedir"
  if [ -z "$basedir" ] || [ -z "$port" ] || [ -z "$pidfile" ] || [ -z "$dbname" ] ; then
    printf 'Invalid configuration\n'
    retval=1
  elif ! [ -d "$basedir" ] ; then
    printf 'No such directory: %s\n' "$basedir"
    retval=1
  elif [ -f "$pidfile" ] ; then
    pid=`cat "$pidfile"`
    printf 'Existing process: %d\n' "$pid"
    retval=1
  else
    if [ -n "$maxcon" ] ; then
      ulimit -n "$maxcon" >/dev/null 2>&1
    fi
    cmd="$cmd -port $port -dmn -pid $pidfile"
    if [ -n "$logfile" ] ; then
      cmd="$cmd -log $logfile"
    fi
    if [ -n "$ulogdir" ] ; then
      mkdir -p "$ulogdir"
      cmd="$cmd -ulog $ulogdir"
    fi
    if [ -n "$ulimsiz" ] ; then
      cmd="$cmd -ulim $ulimsiz"
    fi
    if [ -n "$sid" ] ; then
      cmd="$cmd -sid $sid"
    fi
    if [ -n "$mhost" ] ; then
      cmd="$cmd -mhost $mhost"
    fi
    if [ -n "$mport" ] ; then
      cmd="$cmd -mport $mport"
    fi
    if [ -n "$rtsfile" ] ; then
      cmd="$cmd -rts $rtsfile"
    fi
    if [ -n "$ext" ] ; then
      cmd="$cmd -ext $ext"
    fi
    if [ -n "$extpc" ] ; then
      cmd="$cmd -extpc $extpc"
    fi
    printf "Executing: %s\n" "$cmd"
    cmd="$cmd $dbname"
    $cmd
    if [ "$?" -eq 0 ] ; then
      printf 'Done\n'
    else
      printf 'The server could not started\n'
      retval=1
    fi
  fi
}


# stop the server
stop(){
  printf 'Stopping the server of Tokyo Tyrant\n'
  if [ -f "$pidfile" ] ; then
    pid=`cat "$pidfile"`
    printf "Sending the terminal signal to the process: %s\n" "$pid"
    kill -TERM "$pid"
    c=0
    while true ; do
      sleep 0.1
      if [ -f "$pidfile" ] ; then
        c=`expr $c + 1`
        if [ "$c" -ge 100 ] ; then
          printf 'Hanging process: %d\n' "$pid"
          retval=1
          break
        fi
      else
        printf 'Done\n'
        break
      fi
    done
  else
    printf 'No process found\n'
    retval=1
  fi
}


# send HUP to the server for log rotation
hup(){
  printf 'Sending HUP signal to the server of Tokyo Tyrant\n'
  if [ -f "$pidfile" ] ; then
    pid=`cat "$pidfile"`
    printf "Sending the hangup signal to the process: %s\n" "$pid"
    kill -HUP "$pid"
    printf 'Done\n'
  else
    printf 'No process found\n'
    retval=1
  fi
}


# check permission
if [ -d "$basedir" ] && ! touch "$basedir/$$" >/dev/null 2>&1
then
  printf 'Permission denied\n'
  exit 1
fi
rm -f "$basedir/$$"


# dispatch the command
case "$1" in
start)
  start
  ;;
stop)
  stop
  ;;
restart)
  stop
  start
  ;;
hup)
  hup
  ;;
*)
  printf 'Usage: %s {start|stop|restart|hup}\n' "$prog"
  exit 1
  ;;
esac


# exit
exit "$retval"



# END OF FILE

Tokyo Tyrant インストール

ソースコード取得。
# cd /usr/local/src
# wget http://1978th.net/tokyocabinet/tokyocabinet-1.4.9.tar.gz
# wget http://1978th.net/tokyotyrant/tokyotyrant-1.1.40.tar.gz
TokyoCabinetインストール。
# tar zxvf ./tokyocabinet-1.4.9.tar.gz
# cd tokyocabinet-1.4.9
# ./configure
# make
# make install
TokyoTyrantインストール。
# tar zxvf tokyotyrant-1.1.40.tar.gz
# cd tokyotyrant-1.1.40
# ./configure
# make
# make install
Tokyo Tyrantの起動スクリプトに以下を追加。
# vi /usr/local/tokyotyrant/sbin/ttservctl

# chkconfig: 345 65 55
# description: Startup script for the server of Tokyo Tyrant
# processname: tokyotyrant
/etc/init.dにリンクを作ってchkconfigに登録&確認。
# ln -s /usr/local/tokyotyrant/sbin/ttservctl /etc/init.d/
# chkconfig --add ttservctl
# chkconfig --list ttservctl
ttservctl       0:off   1:off   2:off   3:on    4:on    5:on    6:off

logrotateに登録。
/home/ttserver/data/ttserver.logにTokyo Tyrantのログが書き出されますが、放置しておくと肥大化します。
そのため、ログをローテーションする仕組みに任せてます。
Tokyo Tyrantの起動停止スクリプトがHUPをフォローしてくれているので、これだけでOK。
ここまでやっておけば、永続化機能のついた、OSごと再起動が掛かっても勝手に復活するようになります。
# vi /etc/logrotate.d/tokyotyrant
  
/home/ttserver/data/ttserver.log {
    monthly
    missingok
    rotate 12
    compress
    ifempty
    create
    sharedscripts
    postrotate
        /sbin/service ttservctl hup > /dev/null 2>/dev/null || true
    endscript
}
参考サイト