Posts

CentOS 8 中安裝 chrome 環境

node:102799) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! /var/www/crawler/chromium/linux-800071/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md     at onClose (/snapshot/crawler/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)     at Interface.<anonymous> (/snapshot/crawler/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)     at Interface.emit (events.js:327:22)     at Interface.close (readline.js:424:8)     at Socket.onend (readline.js:202:10)     at Socket.emit (events.js:327:22)     at endReadableNT (_stream_readable.js:1224:12)     at processTicksAndRejections (internal/process/task_queues.js:84:21) (Use `crawler --trace-warnings ...` to show where the ...

Sendmail high cpu usage on CentOS

最近某台主機的 sendmail 使用率偏高 影響到其他程式的執行效率 但我的主機沒有裝 sendmail 後來排除種種問題後發現跟 crontab 有直接的關係 先暫時關掉 crontab 並將餘孽 kill 掉 `top` 中就看不到 sendmail 這支 process 了 原本以為主機中了木馬或是病毒 用 rkhunter 掃了之後跟其他主機都正常 後來想說 sendmail CPU 使用率這麼高 因應該是信件卡住寄不出去之類的 就去查找 queue list 輸入 `mailq` 發現一堆 queue(但輸入 `mail` 卻顯示 No mail for root) 後來查看 /var/log/messages 看到一堆下方的錯誤訊息 `crond[1652]: No configuration file found at /root/.esmtprc or /etc/esmtprc` 查找了一下 esmtp 這個套件相依性跟之前安裝的 google-fluentd 有關 難怪其他主機都沒這個問題 解決方式很簡單 裝個 postfix 就真的解決了 `yum install postfix -y` 參考文章 No configuration file found at /root/.esmtprc or /etc/esmtprc

Cordova Status Bar blank

由於之前因為 WKWebView 的關係 所以升級到 c ordova-ios @5(後來發現跟 io5 似乎沒關係) 但卻也造成 Status Bar 一片白的問題,只會出現綠色的電量 原本會出現日期等資訊 1. 請安裝 cordova-plugin-statusbar 套件 $ cordova plugin add cordova-plugin-statusbar 2. 將下方加入 config.xml         <preference name="StatusBarOverlaysWebView" value="false" />         <preference name="StatusBarBackgroundColor" value="#000000" />         <preference name="StatusBarStyle" value="lightcontent" />         <preference name="StatusBarDefaultScrollToTop" value="false" /> 3. 重新 build $ cordova platform rm ios $ cordova platform add ios@5 請注意,一定要使用 5 的版本 不然會無效喔 參考資訊 Status bar is always white #109

使用 acme.sh 搭配 Let's encrypt 申請 wildcard ssl 憑證

Image
之前一直都是使用 certbot 套件 不過換到 CentOS 8 後 這個套件到今天(2020.05.28)為止還沒支援就是 由於 certbot 是用 pythlon 開發的 所以安裝時會安裝一堆相依的套件 這也是我一直不喜歡用 certbot 的原因 會間接搞亂我的環境 後來找到 acme.sh 是使用 shell script 撰寫的 相對來說單純很多 安裝也很簡單 這個範例是搭配 Cloudflare DNS 做設定 安裝 acme.sh 我是使用 root 執行安裝的 curl  https://get.acme.sh | sh 所以安裝完會出現 /root/.acme.sh 這個資料夾 取得 Cloudflare 的 key 登入你的 cloudflare 帳號後 到這個頁面  https://dash.cloudflare.com/profile/api-tokens 點選下方「Global API Key」右邊的 View 認證完後會取得一組 Key 申請 SSL 憑證 在 /root/ 下新增一個 ssl_cert.sh 檔案 其中 yourdomain.tld 為你自己的網域名稱,如 google.com 因為有指定目錄於 /etc/letsencrypt 中 所以憑證應該會出現在 /etc/letsencrypt/yourdomain.tld 下 由於是 wildcard 的關係,所以會指定兩個 domain 分別為 yourdomian.tld 及 *.yourdomain.tld 請注意,務必讓 yourdomain.tld 在第一個,如果讓 *.yourdomain.tld 在前面的話,你的資料夾就會是 *.yourdomain.tld export CF_Key="your global api key" export CF_Email="你的 cloudflare 登入的帳號(信箱)" /root/.acme.sh/acme.sh --issue -d yourdomain.tld -d *.yourdomain.tld --cert-home /etc/letsencrypt --keylength 2048 --dns dns_cf \ --reloadcmd "system...

ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability.

Image
我的環境是 Cordova 8.1.2 Cordova 4.5.5 由於 Apple 之前已經有預告 2020.4.30 後不支援 UIWebView 需改成 WKWebView 如果沒改的話就會出現下面的錯誤 且上傳自動審核時會直接踢掉 然後直接發如上圖那封信給你 ITMS-90809: Deprecated API Usage  - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more ( https://developer.apple.com/ documentation/uikit/uiwebview ) . 只要依照下面幾個步驟就可以解決這個問題 1. 安裝 cordova-plugin-wkwebview-engine 套件 # cordova plugin add cordova-plugin-wkwebview-engine 2. 使用 cordova-ios 5 的版本(我的環境預設是 4,所以要手動) # cordova platform rm ios # cordova platform add ios@5 3. 修改 config.xml <platform name= "ios" > <preference name= "WKWebViewOnly" value= "true" /> <feature name= "CDVWKWebViewEngine" > <param name= "ios-package" value= "CDVWKWebViewEngine" /> </feature> <preference name= "CordovaWebViewEngine" value= ...

Drupal 8.4 upgrade to 8.6

紀錄從 Drupal 8.4.8 升級到目前最新的 8.6.16 不升級到 8.7.1 是因為可能還不是很 stable 的關係 請注意:更新前先備份資料夾跟資料庫,如果更新失敗還可以復原 Drupal8 升級 Kernel 的方式好像跟之前不太一樣 主要是透過移除 `/core` 及 '/vendor' 資料夾後 再將新版本的這兩個資料夾上傳 上傳完後執行 `update.php` 執行 `update.php` 需要注意 `/sites/default/files` 的權限問題 另外不建議一直就直接跨越升級 8.4 -> 8.6 建議先升到下個版本的最新版 然後執行上述步驟重傳 `/core` & `/vendor` 及執行 `update.php` 等 Kernel 升級完後 最後再來升級 modules Drupal8 的 modules 預設在 `/modules/contrib` 裡面 也是將舊版的 module 資料夾刪除後重新上傳 module 都上傳完後再執行 `update.php` 即可 環境: Drupal 8.4.8 PHP 7.1.27 CentOS 7.5

mac 安裝 mtr

Image
macOS 上要安裝 mtr 看似簡單 $ brew install mtr 如果沒安裝過 HomeBrew 請參考這邊 mtr 可拿來檢查點對點中間的網路狀態 它結合 ping 及 traceroute 的功能 已內建於大多數的 Linux 中 詳細的說明可參考這邊 但這邊有個坑 由於安裝好的 mtr 不在 /usr/local/sbin 中 macOS 中也不存在這這個目錄(macOS 10.14.3) 所以會出現以下的錯誤 Error: The brew link step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink sbin/mtr /usr/local/sbin is not writable. You can try again using: brew link mtr ==> Caveats mtr requires root privileges so you will need to run sudo mtr . You should be certain that you trust any software you grant root privileges. 執行 brew link mtr 會出現 Linking /usr/local/Cellar/mtr/0.92… Error: Could not symlink sbin/mtr /usr/local/sbin is not writable. 如何設定 1. 建立目錄及設定權限 sudo mkdir /usr/local/sbin && sudo chmod ug+rwx /usr/local/sbin && sudo chown $(id -un):admin /usr/local/sbin 2. 設定 PATH 如果有裝 zsh 的話 請編輯 vi .zshrc 如果沒有使用 zsh 請編輯 vi .bash_profile 將下面的部分貼到最下方 export PA...