2006年05月08日
tinydnsのdataファイルとdata.cdbファイルの比較
dataとdata.cdbがほぼ同時刻に生成された事を確認したい。
$ man sh
file1 -nt file2
True if file1 is newer (according to modification date) than
file2, or if file1 exists and file2 does not.
file1 -ot file2
True if file1 is older than file2, or if file2 exists and file1
does not.
-nt でも -ot でも同時刻の場合にfalseを返して来る。
同時刻である場合の比較演算子が無いではないか!
そもそもそんな比較をするヤツは居ないく需要は低いのだろう。
秒単位ではなく分単位での比較をしている模様。
やりたい事を満たせるので結局こうした。
#!/bin/sh
is_same_mtime() {
[ $# = 2 ] || return 1
(! [ $1 -nt $2 ] && ! [ $1 -ot $2 ])
return $?
}
cronで実行しているからtinydns-dataの実行終了に60秒もかかる事
はないはずだ!サーバが高負荷の時は発生してしまうかも知れない。
dataとdata.cdbがほぼ同時刻に生成された事を確認したい。
$ man sh
file1 -nt file2
True if file1 is newer (according to modification date) than
file2, or if file1 exists and file2 does not.
file1 -ot file2
True if file1 is older than file2, or if file2 exists and file1
does not.
-nt でも -ot でも同時刻の場合にfalseを返して来る。
同時刻である場合の比較演算子が無いではないか!
そもそもそんな比較をするヤツは居ないく需要は低いのだろう。
秒単位ではなく分単位での比較をしている模様。
やりたい事を満たせるので結局こうした。
#!/bin/sh
is_same_mtime() {
[ $# = 2 ] || return 1
(! [ $1 -nt $2 ] && ! [ $1 -ot $2 ])
return $?
}
cronで実行しているからtinydns-dataの実行終了に60秒もかかる事
はないはずだ!サーバが高負荷の時は発生してしまうかも知れない。