這次遇到的主因是因為寫log 的部分出問題導致
在登入後,家目錄下會有一個.bashrc 的檔案,該檔案會載入共用的/etc/bashrc,將裡面的function 載入使用
但是/etc/bashrc 最下面有這個function
datestamp_history(){
#export infodate=`date "+%Y-%m-%d %H:%M:%S"`
unset HISTCONTROL
export infohisline1=`history 1|awk '{print $1}'`
if [ "$infohisline1" == "" ];then
infohisline1=0
fi
if [ $infohisline1 -gt $infohisline2 ];then
command=$(history 1 | { read x y; echo $y; });
logger -p local3.notice -t bash -i "user=$USER,from=$SSH_CLIENT,pwd=$PWD,command:$command";
elif [ "$infohisline2" == "0" ] && [ "$login_type" == "N" ];then
logger -p local3.notice -t bash -i "user=$USER,from=$SSH_CLIENT,pwd=$PWD,command:$(date "+%Y/%m/%d %T ")login";
login_type='Y'
fi
#export infohisline2=`echo $infohisline1`
infohisline2=`echo $infohisline1`
}
問題在於 logger 的部分會往local3.notice 寫 log,但是設定上有問題導致卡在這邊,我們可以簡單的解決此問題
vi /etc/bashrc
在最下方加上
export PROMPT_COMMAND=
即可
接下來只要重新登入就可以將此function 設定成沒有function ,也就不會寫log 造成卡住了,當然也可以處理壞掉的 logger…
/etc/rsyslog.conf
裡面有定義 local3.* 要把檔案寫到哪裡去...