2015年3月2日 星期一

更換NAS的硬碟

因為家中的Synology DS413 NAS,其中有一顆日立1TB的硬碟出現壞軌,便添購Toshiba 3TB的硬碟來更換。

不過這Toshiba 3TB的硬碟居然是2014年2月出廠的,在倉庫放了一年嘛?

因為當初建置時是用SHR(Synology Hybrid Raid),將NAS關機之後,直接抽換掉有問題的硬碟然後開機進行修復。歷經rebuild->reshape->resize的過程,大約花了一天的時間,其中歷時最久的是進行reshape。

下次要換硬碟應該會整台重做,用兩顆一組做SHR,不然修復的時間有夠久的... Orz

2015年2月4日 星期三

Chrome對於Linux的支援依然很爛

大概Chrome的工程師都是用Mac的,他們對Linux的使用者一點也不在乎。

在Linux上頭安裝思源黑體,並在fontconfig裡頭設定。

Chrome 40.0.2214.95
Firefox 35.0.1
Chrome不知道為什麼選了 Source Han Sans Light,內文沒辦法閱讀。相對來說Firefox則十分正常。

這個問題從2013年就有人回報,到現在依然沒有任何改進。
Chrome ignores fontconfig pixelsize settings

2015年1月22日 星期四

之前我的朋友因為支付寶退款的問題,需要打電話到中國,而Hangout之前有推出撥打電話的服務,就試著撥過去看看,沒想到通話似乎完全沒有延遲,費用還非常低廉。

以台灣為例,手機撥市話以每分鐘計算,Hangout是0.6元,中華4G是6元,雖然中華是以秒計費,但是只要講超過6秒,就比Hangout貴了。 XD


Google Hangout calling rates
https://www.google.com/voice/b/0/rates?hl=en&p=hangout

中華4G費率
http://www.emome.net/data_plan/4g_rate

2015年1月5日 星期一

Roundcube使用password plugin (chpasswd driver)的方式

基本上參考這一篇
http://www.roundcubeforum.net/index.php?topic=21861.0
之前實作的時候一直碰到密碼更改失敗的情況,看log也看不出所以然,只看到Unable to execute sudo。原來sudoers裡頭預設有"Defaults    requiretty"這個設定,php在執行chpasswd是沒有console的,所以無法執行,照這篇文章修改就行。
1) enable password function

vi /var/www/html/roundcube/config/config.inc.php

- alter the following line as follows:

$config['plugins'] = array('password');

cd /var/www/html/roundcube/plugins/password
cp config.inc.php.dist config.inc.php

2) enable the password plugin

cd /var/www/html/roundcube/plugins/password
cp config.inc.php.dist config.inc.php

vi config.inc.php

- alter the following as follows:

$config['password_driver'] = 'chpasswd';

3) allow apache to run the script

visudo

- add to bottom

Defaults:apache !requiretty
apache ALL=(root) NOPASSWD: /usr/sbin/chpass-wrapper.py

4) add blacklisted users and minimum UID below

vi /var/www/html/roundcube/plugins/password/helpers/chpass-wrapper.py

BLACKLIST = (
    # add blacklisted users here comma separated
    'root'
)

if user.pw_uid < 494:
    sys.exit('Changing the password for user id < 494 is forbidden')

5) copy the helper to executable directory & set make it executable
   
cp /var/www/html/roundcube/plugins/password/helpers/chpass-wrapper.py /usr/sbin
chmod 755 /usr/sbin/chpass-wrapper.py

6) alter the driver to run the helper which in turn runs the driver (wraps it)

vi /var/www/html/roundcube/plugins/password/config.inc.php

old:
$config['password_chpasswd_cmd'] = 'sudo /usr/sbin/chpasswd 2> /dev/null';
new:
$config['password_chpasswd_cmd'] = 'sudo /usr/sbin/chpass-wrapper.py 2> /dev/null';

2014年12月18日 星期四

CentOS 7, systemd, redis, max open files

在CentOS 7安裝好Redis,預設redis會開啟10000的檔案,所以啟動之後log總會顯示以下錯誤:
Current maximum open files is 1024. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
即使修改/etc/security/limits.conf也沒有用,這個檔案一開頭就說:
This file sets the resource limits for the users logged in via PAM.
It does not affect resource limits of the system services.
因為CentOS 7用systemd換掉ntsysv,網路上有提示解法,就是修改redis的systemd配置檔案/lib/systemd/system/redis.service正確來說是/etc/systemd/system/redis.service.d/limit.conf,把LimitNOFILE=10240後面的數字改成所需的。

修改之後,要先重新載入systemd,否則會出現警告。如下
$ service redis restart
Redirecting to /bin/systemctl restart  redis.service
Warning: Unit file of redis.service changed on disk, 'systemctl daemon-reload' recommended.