1.下載安裝
wget https://tos-tools.tos-cn-beijing.volces.com/third-party%2Frclone-current-linux-amd64.zip
unzip third-party%2Frclone-current-linux-amd64.zip
cd rclone-v1.58.0-linux-amd64
2.複製二進位制檔案並修改許可權
sudo cp rclone /usr/bin/
sudo chown root:root /usr/bin/rclone
sudo chmod 755 /usr/bin/rclone
3.檢查是否已安裝成功
rclone version
掛載(可選)
ln -s /home/data /mnt/
4.常用命令
rclone config file #檢視路徑
/root/.config/rclone/rclone.conf #修改配置
[volces-tos]
type = s3
provider = Storj
access_key_id = AKLTNzFhY2IwNzJlNTA
secret_access_key = TlRBMVpUJM05XTQ==
endpoint = https://tos-s3-cn-shanghai.volces.com/
force_path_style = false
disable_http2 = true
list_version = 2
[local]
type = local
path = /home/vision/slatest/aa
5.啟動服務
rclone serve http --addr 0.0.0.0:80 local:/mnt/data/dlyphoneapps/ &
6.定時檢查測服務
# 檢查rclone
* * * * * /mnt/data/check_rclone_server.sh > /dev/null
# 每三分鐘同步一次
*/3 * * * * rclone sync volces-tos:yunshoujiappstore/yunshoujiappstore /mnt/data/dlyphoneapps/yunshoujiappstore --ignore-existing --bwlimit 20M --log-file /mnt/data/rclone-appstore.log --log-level INFO
#!/bin/bash
# 定義埠號
PORT=80
# 使用 netstat 檢查埠是否已經被佔用
# -tulpn 顯示 TCP 和 UDP 的埠及其程式
# grep -w 匹配完整的單詞
if ! netstat -tulpn | grep -w ":$PORT"; then
#echo "Port $PORT is not in use. Starting rclone..."
# 埠未被佔用,啟動 rclone 服務
rclone serve http --addr 0.0.0.0:80 local:/mnt/data/dlyphoneapps/ &
echo "$(date) Port $PORT is not in use. Starting rclone..." >> /mnt/data/rclone-http.log
else
echo "Port $PORT is already in use. No action required."
fi