find . -type f -empty -exec rm {} \;
星期四, 3月 16, 2017
星期三, 3月 01, 2017
Linux fuser 造成主機系統負載過高,網站開啟不了的解決方式
Cause
The script
plesk-php-cleanuper contains a string ' ! -execdir fuser {} \\ ', which opens every file in the/var/lib/php/session directory and checks that it is not used by a working process and can be deleted. However, the maximum number of open files is set to 1024 by default.fuser是一個UNIX命令,用於顯示哪些進程正在使用指定的文件,文件系統或unix套接字,find命令用於查找Unix或Linux系統上的文件
1. 使用 ps aux | grep 'fuser' 指令查出, fuser 所使用的pid號
2. 再使用 kill -9 8352 強制停止該程序。 8352 是fuser pid號
3. 如果網站還是無法正常顯示重新啟動 httpd
#/etc/init.d/httpd restart
問題產生原因如下 :
PHP Session Cleanup failing
https://support.plesk.com/hc/en-us/articles/213947925-PHP-Session-Cleanup-failing
星期一, 2月 27, 2017
Linux convmv 轉換編碼指令 將 big5轉換成 utf8
這隻主要是隻 Perl script, 該做 轉換/備份/測試/偵測環境 等等, 都寫的蠻完整的.
convmv 轉換編碼指令
- convmv -f big5 -t utf-8 -r --notest *
- -f big5: 從 Big5 編碼轉換 (不過標準應該是要寫 big5-eten, 但是我測試 big5 也可以動. :P)
- -t utf-8: 轉換編碼到 UTF-8
- -r: 遞迴的將目錄下的所有檔名都做轉換
- --notest: 如果不下這個, 一切動作都只是測試, 會直接將轉換前和轉換後的檔名列給你看, 這加下去, 才會實際轉換檔名.
- *: 所有檔案
其他參數
- --list : 列出所有可用的編碼
- --unescape : 轉換檔名中 %xx 這種 16 進位的編碼 (mv "./a%20x.jpg" "./a x.jpg")
- --lower : 將所有檔名都轉小寫(ex: convmv --lower LOWER.txt)
- --upper : 將所有檔名都轉大寫
- -i : 互動模式, 轉換前會先經過 y/n 確認
- 更多詳細可 man convmv 或 convmv --help, 除此之外, 可以另外再搭配 rename 做些其他應用~
資料來源 https://blog.longwin.com.tw/2008/07/convmv_utf8_big5_convert_linux_2008/
星期二, 9月 27, 2016
Error on Home page: New configuration files for the Apache web server were not created
Symptoms
There is an error message on the Home page or in Domains > example.com page:
New configuration files for the Apache web server were not created due to the errors in configuration templates: Template processing failed: file = /usr/local/psa/admin/conf/templates/default/domainForwarding.php, error = Template_Exception: No data. file: /usr/local/psa/admin/plib/Template/Processor.php line: 27 code: 0 Previous error: Template_Variable_Exception: No data. file: /usr/local/psa/admin/plib/Template/Variable/AbstractCachedData.php line: 65 code: 0. The error message containing the detailed error descriptions was sent to you by e-mail. Please resolve the issues and click here to generate broken configuration files once again or here to generate all configuration files.
There are one or more entries in
Configurations table with error status:MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -Ne"select * from Configurations where status='error'\G"
Cause
Entries for several domains are absent in
psa database.Resolution
Get the affected domain name:
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -Ne"select name from domains where id in (select objectId from Configurations where status='error')"
Reconfigure domain name in question:
/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain example.com
If some configurations still need to be fixed, run the following:
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -Ne"delete from Configurations where status='error' \G"
星期四, 9月 22, 2016
我的服務器有防火牆保護,如何為ProFTPd的配置被動端口範圍?
這陣子使用 Sublime vsftp 來上傳資料,但總是被伺服器端的防火牆拒絕,調整一下防火牆的設定讓系統也能接受被動式連線。
我的服務器有防火牆保護,如何為ProFTPd的配置被動端口範圍?
我的服務器有防火牆保護,如何為ProFTPd的配置被動端口範圍?
- 應用到:
- 12.5的Plesk為Linux
- 的Plesk 12.0適用於Linux
- 的Plesk 11.0適用於Linux
- 的Plesk 11.5適用於Linux
解決方案
PassivePorts用於指令/etc/proftpd.conf文件來指定被動端口範圍把該指令置入,Global容器,如下所示:<Global>
.....
.....
PassivePorts 57000 58000
</Global>
查看ProFTPd的文檔了解更多有關PassivePorts指令的信息:http://proftpd.org/docs/directives/linked/config_ref_PassivePorts.html。
接下來,在應該中系統-加載
ip_conntrack_ftp模塊:# /sbin/modprobe ip_conntrack_ftp
# lsmod | grep conntrack_ftp
nf_conntrack_ftp 13696 0
nf_conntrack 61684 1 nf_conntrack_ftp
同時,應通過以下方式配置
iptables:iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
如果服務器有NAT,還需則加載
ip_nat_ftp模塊:# /sbin/modprobe ip_nat_ftp
要想在系統啟動後保留修改,把請該模塊添加至
/etc/sysconfig/iptables-config的IPTABLES_MODULES行(空格隔開)。星期五, 7月 15, 2016
惡意攻擊 Apache 連線滿載,造成記憶體爆滿
Apache Status 即時記錄中,發現有個來自羅馬尼亞的IP持續使用POST方式發送連線需求。
重新啟動 Apache 後,利用iptable 擋掉這個 IP
下圖可看到 產生四千多筆連線。
重新調整 apache httpd.conf 設定如下
<IfModule prefork.c>
StartServers 5
MinSpareServers 10
MaxSpareServers 20
ServerLimit 1500
MaxClients 1450
MaxRequestsPerChild 4000
</IfModule>
編輯 iptable 限制單一IP 最大的連線數為100個
#vi /etc/sysconfig/iptables
-A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 100 -j REJECT --reject-with tcp-reset
希望以上作法能有效抵擋惡意攻擊~~~
星期三, 5月 11, 2016
DEWALT 得偉 DC988 18V充電震動電鑽 配一電一充
雖然已經有買了Bosch的插電用電鑽,但還是需要一隻不需要插電而能快速更換鑽頭的電鑽
個人對得偉的機器有很高的評價,上網找了二手機器,看網路資料貨品是從大陸進來
電鑽跟電池是分開寄送的,主機到貨後表面有些生鏽,先用砂紙去鏽後再拆機件做內部齒輪
油更換,測試過得偉的機器好用又有力。
商品入手價 $2550
型號:DC988 1.外殼為高強度工程塑,極為堅固耐用 2.電鑽/電動螺絲刀兩用,雙向無級調速 3.高扭矩馬達,最高扭矩可達65扭米 4.使用鑽頭最大直徑13mm 5.得偉專利分三種鑽速:0-450轉/分鐘、0-1450轉/分鐘、0-2000轉/分鐘 6.衝擊率:34000次/分 7.可以設定22檔扭力調節,使上螺絲的時候不會造成螺絲鬆緊不一的情況 8.本電鑽的夾頭也是採用自鎖夾頭,設計非常精巧,只要用手就可以把任何鑽頭之類的配件牢固夾緊,根本不費力,那是低階工具無法比擬的 9.握把手感舒適,完全符合人體工學設計; 10.電子刹車; 11.配原裝快速充電器,保證了充電的品質及電池的使用壽命,充電時間僅為50~90分鐘(因電池而異)。 12.配充電電池; 13.帶強力衝擊功能,可以鑽牆、鑽鋼板、鑽木。
空壓機
因沒太多預算,在網路上找了一台大陸製的空壓機做木工常常需要清理桌面上的木屑,這時空壓機就非常好用 另外如果你常用釘槍來工作,需要空壓機來提供氣體壓力 空壓機在打氣時,發出的噪音其實也蠻吵的,如果空間許可,將它裝到離工作 較遠的地方會是比較好的選擇。 如果在太吵雜的環境,對做木工是種干擾。 如果下次換機器,會考慮高檔的,聲音不要太大,儲氣桶大些,可以不需要一直打氣, 有個車行朋友推薦買機車店那種尺寸雙汽缸的二手貨,大約兩萬上下。 使用感受:堪用但品質不夠好(使用過後覺得便宜沒好貨,請買台灣製的) 機器規格:2馬力 10公升
Bosch 手提砂輪機
手提砂輪機是很早期就購入的工具,可調速使用上會比較安全。
使用上還是需要注意安全,如果轉速過快,機器還是會拿不穩。
是屬於比較多用途的工具,雖然是大陸製,但品質還是很不錯。
入手價是 $1800元
輸入功率:720W
空載速率:2800~9300rpm
軸心螺紋:M10
適用磨 / 切片-直徑:100mm/4"
適用橡膠磨盤-直徑:100mm/4"
無電源線重量:1.5kg
附件:保護蓋、板手、輔助把手
製造國家:中國
德國STIHL MS-170鏈鋸(鍊鋸) +10"原廠雕刻導板+原廠鏈條
STIHL MS-170(10"雕刻板)鏈鋸 汽缸容量: 30.1立方公分 輸出功率: 1.3kW / 1.8bhp 重量 : 3.9kg 切割長度: 約25公分 原廠配件:火星塞套筒+小起子+原廠說明書
訂閱:
文章 (Atom)







