screen 可以在建立時,為 session 命名:
$ screen -S name
若日後需要修改名稱,可以先 attach session 以後,按下 C-a,在輸入指令:
:sessionname newName
之後 screen -r 就可以看到新的名稱。
軟體開發、伺服器和生活瑣事
screen 可以在建立時,為 session 命名:
$ screen -S name
若日後需要修改名稱,可以先 attach session 以後,按下 C-a,在輸入指令:
:sessionname newName
之後 screen -r 就可以看到新的名稱。
若要交換 window 1 和 window 5 的順序,先 focus 到 window 1,再進入指令模式:
C-a :number 5
windows 1 和 windows 5 的順序便會對調。
手殘常常不小心按到其他按鍵 (該說鍵盤太好按嗎?),而 terminal 就突然沒有反應了。以前的解法是先 terminate 以後,用 screen detach 再 attach。
今天才發現 screen 有個畫面鎖定的功能:
C-a C-x (lockscreen) Lock this terminal.
lock 以後,可以用 ^Q 或是 ^A^Q unlock。
Ref:
http://stackoverflow.com/questions/70614/gnu-screen-survival-guide
Redmine server 一直沒辦法寄出異動通知,Redmine log 有記錄寄信,但沒有錯誤訊息。後來發現 Postfix log 出現一些奇怪的字樣:
postfix/smtpd[31217]: connect from localhost[127.0.0.1]
postfix/smtpd[31217]: lost connection after STARTTLS from localhost[127.0.0.1]
postfix/smtpd[31217]: disconnect from localhost[127.0.0.1]
查了一下,是因為 Postfix 檢查 TLS 失敗,所以沒辦法寄信。把 TLS 關閉即可。
/etc/postfix/main.cf:
smtpd_use_tls=no
Reference:
Problem using TLS: lost connection after STARTTLS
http://postfix.1071664.n5.nabble.com/Problem-using-TLS-lost-connection-after-STARTTLS-td58911.html
覺得輸入完帳號、密碼到 prompt 出現速度實在有點太慢,檢查了 .bashrc 發現在 bash_completion 之前,還有 script 拖到時間。
每次登入都會看到這個畫面,:
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 3.9.3-x86 i686)
* Documentation: https://help.ubuntu.com/
System information as of Wed Oct 23 09:35:28 CST 2013
System load: 0.66 Processes: 163
Usage of /: 65.8% of 46.01GB Users logged in: 0
Memory usage: 39% IP address for eth0: 127.0.0.1
Swap usage: 10%
Graph this data and manage this system at https://landscape.canonical.com/
Last login: Wed Oct 23 09:30:26 2013 from some.where.net
除了 uptime 以外,還會有需要更新的套件數量統計,不禁懷疑是否就是統計套件更新數量在慢。
先搜尋訊息存在哪裡:
$ grep -s -r "System information" /etc
motd: System information as of Wed Oct 23 09:35:28 CST 2013
update-motd.d/50-landscape-sysinfo: echo -n " System information as of "
update-motd.d/50-landscape-sysinfo: echo " System information disabled due to load higher than $threshold"
看來是跟 motd 有關。man 一下, motd 的意思是「message of a day」,而 /etc/update-motd.d 下則是用來統計系統資訊的 script。
而 update-motd.d 的 script 是否在 login 時執行還不曉得,找個時間在繼續追。