指令 rsync -av --delete source target 中:
-a:相當於-rlptgoD,同步資料一般就是用-a--delete:若 source 中的檔案被刪除、不存在,則一併刪除 target 中的資料
還有一些方便的參數可用:
--partial:保留傳輸未完成的檔案,供下次繼續--progress:顯示檔案傳輸的進度
軟體開發、伺服器和生活瑣事
指令 rsync -av --delete source target 中:
-a:相當於 -rlptgoD,同步資料一般就是用 -a--delete:若 source 中的檔案被刪除、不存在,則一併刪除 target 中的資料還有一些方便的參數可用:
--partial:保留傳輸未完成的檔案,供下次繼續--progress:顯示檔案傳輸的進度發現 Razer 官方有提供 Linux 的工具:https://openrazer.github.io/。
目前還沒找到方法把滑鼠 RGB 燈光關掉,但一些功能按鍵可以使用了。
phpbrew install 8.0.11 時會出現 OpenSSL 的錯誤訊息:
/home/zero/.phpbrew/build/8.0.29/ext/openssl/xp_ssl.c:1240:9: warning: ‘DH_free’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
1240 | DH_free(dh);
| ^~~~~~~
In file included from /usr/include/openssl/dsa.h:51,
from /usr/include/openssl/x509.h:37,
from /usr/include/openssl/ssl.h:31,
from /home/zero/.phpbrew/build/8.0.29/ext/openssl/xp_ssl.c:31:
/usr/include/openssl/dh.h:200:28: note: declared here
200 | OSSL_DEPRECATEDIN_3_0 void DH_free(DH *dh);
| ^~~~~~~
主要是因為舊版的 PHP 使用到的 OpenSSL 也是舊版的。
解決方法:
先下載 OpenSSL v1.1,並編譯:
cd ~/tmp/openssl-1.1.1v # --prefix 設定為暫存路徑 ./Configure --prefix=/home/zeroplex/openssl-1.1.1/ -fPIC -shared linux-x86_64 make make install
make install 後執行檔、函式庫就會存放到 /home/zeroplex/openssl 中。
先設定要使用的 OpenSSL pkgconfig:
# 在 openssl 位置中找到 pkgconfig 的路徑 export PKG_CONFIG_PATH=/home/zeroplex/openssl/lib/pkgconfig
接下來 phpbrew 使用相同的指令即可:
phpbrew install 8.0.29 +defaults
備註:phpbrew install 7.4 也需要相同的方法
之前提過可以自己在儲存空間上建立 swap file,而儲存空間可以是傳統硬碟,所以設定 swap file 使用優先順序是有差的。
在 /etc/fstab 的 mount option 中加入 pri:
# <file system> <mount point> <type> <options> <dump> <pass> /dev/sdb none swap sw,pri=0 0 0 /swapfile none swap sw,pri=-2 0 0
其中 pri 數值越大表示優先權越高。範例中會先使用 /dev/sdb 的空間,用光後再使用 /swapfile。
以下範例,會建立一個 4GB 的 SWAP 用檔案,並 mount 起來。
建立 4GB 的檔案供 SWAP 使用:
sudo fallocate -l 4G /swapfile sudo dd if=/dev/zero of=/swapfile bs=1G count=4 # 注意權限必須是 600 sudo chmod 600 /swapfile
檔案格式化為 swapfile:
sudo mkswap /swapfile
到這邊都沒有遇到問題的話,就可以使用 swapon 來讓 Linux mount 起來使用:
sudo swapon /swapfile
如果希望開機以後讓 Linux 自動 mount 起來,可修改 /etc/fstab 檔案:
# <file system> <mount point> <type> <options> <dump> <pass> /swapfile none swap sw 0 0