【サーバ運用】ファイルサーバのrootのhistoryが取れてない!

唐突ですが、うちのファイルサーバのrootの.history_tty*
(デフォルトのままなんでtcsh使ってます)
がどうやら取れていないようなのです。
幸い取り損じたhistoryは/tmpの中にあったのですが、
このままでは今後もhistoryが/tmpの中に入り続けるため
あまり美しくありません。早速対策をとることに。
サーバ運用は自己満足と美意識で行われているものです。
ああ、あとセキュリティ対策もね。

つーわけで、まずはtcshrcでも見てみることに。

# jove /root/tcshrc

――中略――

# merge history files
#
if ( -d /usr/bin/ ) then
touch /tmp/roottcshhistory$$ ${histfile}
chmod 600 /tmp/roottcshhistory$$ ${histfile}
cat ~/.history* | paste - - | sort | uniq -f 1 | \
awk '{print $1 "\n" substr($0, 14, length($0) - 13)}' | \
tail -n ${history} \
> /tmp/roottcshhistory$$
mv /tmp/roottcshhistory$$ ${histfile}
endif

――後略――

ふーむ……これによってtmpに入ってるみたいですね。
本来このスクリプトでは一端tmpに納めたヒストリを
各ユーザーのhistoryにマージコピーする事になっているようですが、
tmpが残りっぱなしな所を見る限り明らかにマージコピーに
失敗しているようです。こいつを何とかすれば直りそうだ。

ところで、これを実際にシェル上で実行してみるとどうなるのかな?
エラーメッセージが出てきてくれれば目処が立つかも。
というわけで早速実行します。

xxx /root# if ( -d /usr/bin/ ) then
touch /tmp/roottcshhistory$$ ${histfile}
chmod 600 /tmp/roottcshhistory$$ ${histfile}
cat ~/.history* | paste - - | sort | uniq -f 1 | \
awk '{print $1 "\n" substr($0, 14, length($0) - 13)}' | \
tail -n ${history} \
> /tmp/roottcshhistory$$
mv /tmp/roottcshhistory$$ ${histfile}
endifxxx /root# touch /tmp/roottcshhistory$$ ${histfile}
xxx /root# chmod 600 /tmp/roottcshhistory$$ ${histfile}
xxx /root# cat ~/.history* | paste - - | sort | uniq -f 1 | \
# awk '{print $1 "\n" substr($0, 14, length($0) - 13)}' | \
# tail -n ${history} \
# > /tmp/roottcshhistory$$
xxx /root# mv /tmp/roottcshhistory$$ ${histfile}
xxx /root#endif
xxx /root#

・・・
エラーメッセージは出ませんでしたね。成功しちゃったのかな?

xxx /root# ls -la
total 176
drwxr-xr-x 4 root wheel 512 Nov 1 22:44 .
drwxr-xr-x 22 root wheel 512 Oct 6 04:46 ..
-rw-rw-rw- 1 root wheel 1637 Feb 17 2006 .bash_history
-rw-r--r-- 2 root wheel 803 Jan 10 2006 .cshrc
-rw-rw-rw- 1 root wheel 7457 Apr 1 2006 .history-
-rw-rw-rw- 1 root wheel 766 Jan 10 2006 .history-console
-rw