centos7 安装 rclone
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 sync volces-tos:yunshoujiappstore/yunshoujiappstore /mnt/data/dlyphoneapps/yunshoujiappstore # 同步远端到本地
rclone config file #查看路径
/root/.config/rclone/rclone.conf #修改配置
rclone size volces-tos:yunshoujiappstore/yunshoujiappstore # 查看远端oss大小
du -sh /mnt/data/dlyphoneapps/yunshoujiappstore # 查看本地大小
[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
本文来自博客园,作者:六月OvO,转载请注明原文链接:https://www.cnblogs.com/chenlifan/p/18497712