找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 3508|回复: 14

如何在Openwrt中保持一直运行rclone ?

[复制链接]
发表于 2021-10-14 09:08 | 显示全部楼层 |阅读模式
问题如下:
我在Openwrt中使用rclone挂载googledrive来对接emby,但无论是通过在新的screen下运行下rclone,还是使用nohup,甚或使用rclone自带的--daemon参数,都能让rclone保持运行几天,然后在不确定几天后,rclone就会被自动关闭,我想在openwt中实现rlcone关闭后自动重启,请问有什么办法吗?我参考这个源码(https://github.com/1phalley/smartdnsprocd)写了个守护脚本,发现根本不起作用。
我的恩山、我的无线 The best wifi forum is right here.
 楼主| 发表于 2021-10-14 09:11 | 显示全部楼层

Openwrt能保持一直运行rclone吗

问题如下:
我在Openwrt中使用rclone挂载googledrive来对接emby,但无论是通过在新的screen下运行下rclone,还是使用nohup,甚或使用rclone自带的--daemon参数,都能让rclone保持运行几天,然后在不确定几天后,rclone就会被自动关闭,我想在openwt中实现rlcone关闭后自动重启,请问有什么办法吗?我参考这个源码(https://github.com/1phalley/smartdnsprocd)写了个守护脚本,发现根本不起作用。
不清楚在这个版块发布是否合适,我已经在x86板块发布,如有问题,删除任意一个帖子就好。问题让我折腾了好久,迟迟不能解决,在此请教各位大神
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-10-14 09:23 | 显示全部楼层
不懂,但是顶一下,让跟多人看到。
我提的两个问题没有同志回复啊。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-10-14 09:44 | 显示全部楼层
不是rclone自动关闭,你要留意某些网盘的exprie很短, 我也不知道跟这个有没有关系.我在路由上也很容易断开连接,但是在VPS上却很稳定.
另外问一下,你有没有mount drive, mount的命令具体是怎么写的.

点评

我一般这样写, sudo /usr/bin/rclone mount GD : /home/GoogleDrive/local --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --default-permissions --buf  详情 回复 发表于 2021-10-18 08:43
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-10-14 09:46 | 显示全部楼层
刚刚才说在VPS很稳定,结果上去一看,又断了.
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-10-14 09:59 | 显示全部楼层
启动脚本 rpcd

点评

什么是rpcd,请教  详情 回复 发表于 2021-10-18 08:43
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-10-14 14:37 | 显示全部楼层
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2021-10-18 08:43 | 显示全部楼层
siukong 发表于 2021-10-14 09:44
不是rclone自动关闭,你要留意某些网盘的exprie很短, 我也不知道跟这个有没有关系.我在路由上也很容易断开连 ...

我一般这样写,
sudo /usr/bin/rclone mount GD  : /home/GoogleDrive/local --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --default-permissions --buffer-size 32M --dir-cache-time 12h --vfs-read-chunk-size 64M --vfs-read-chunk-size-limit 1G --drive-v2-download-min-size 0 >/dev/null 2>&1 &
但不管怎么写,都是过段时间就会挂掉,GD和OD 都一样

点评

你运行完这段命令后,有没有任何返回提示? 我是这样写,会提示有点错误,但不影响mount成功. 在VPS上稳定运行几天就断. 不知何故,应该不是expire. root@OpenWrt:~# rclone -vv mount gdrive: /mnt/gdrive --allow-o  详情 回复 发表于 2021-10-19 21:33
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2021-10-18 08:43 | 显示全部楼层

什么是rpcd,请教
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2021-10-18 08:45 | 显示全部楼层
有没高手写个rlcone的守护进程,在rclone退出后自动启动,我小白一个,照网上教程模拟写了个,虽然运行没报错,但好像也没起效果
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-10-18 10:00 | 显示全部楼层
dzhl1201 发表于 2021-10-18 08:43
什么是rpcd,请教

就像这样

#!/bin/sh /etc/rc.common

START=99
USE_PROCD=1
LOGFILE='/var/log/vhusbd.log'
CONFIG='/etc/vhusbd.ini'
PROG='/usr/sbin/vhusbd'

service_triggers() {
        procd_add_reload_trigger "vhusbd"
}

start_instance() {
        config_get_bool enabled "$1" 'enabled' '0'
        config_get ipv6 "$1" 'ipv6' '0'
        config_get syslog "$1" 'syslog' '0'
}

start_service() {
        config_load 'vhusbd'
        config_foreach start_instance 'vhusbd'

        [ "$enabled" -gt 0 ] || return 1

        [ "$ipv6" -gt 0 ] && append OPTIONS "-i"
        [ "$syslog" -gt 0 ] || append OPTIONS "-r $LOGFILE"

        procd_open_instance #启动进程实例 进程必须挂在前台
        procd_set_param command $PROG #执行启动命令
        procd_append_param command $OPTIONS -c $CONFIG
        procd_set_param respawn #启用进程守护
        procd_set_param stdout 1
        procd_set_param stderr 1
        procd_close_instance #关闭进程实例 等同于 CTRL + C
}

点评

看不懂啊,能帮忙写个rclone的吗?我看也有不少人有类似需求  详情 回复 发表于 2021-10-18 10:03
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2021-10-18 10:03 | 显示全部楼层
401626436 发表于 2021-10-18 10:00
就像这样

#!/bin/sh /etc/rc.common

看不懂啊,能帮忙写个rclone的吗?我看也有不少人有类似需求
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-10-19 21:33 | 显示全部楼层
dzhl1201 发表于 2021-10-18 08:43
我一般这样写,
sudo /usr/bin/rclone mount GD  : /home/GoogleDrive/local --copy-links --no-gzip-e ...

你运行完这段命令后,有没有任何返回提示?
我是这样写,会提示有点错误,但不影响mount成功. 在VPS上稳定运行几天就断. 不知何故,应该不是expire.

root@OpenWrt:~# rclone -vv mount gdrive: /mnt/gdrive --allow-other --allow-non-empty --vfs-cache-mode writes &
[1] 10026
root@OpenWrt:~# 2021/10/03 21:12:47 DEBUG : rclone: Version "v1.56.1" starting with parameters ["rclone" "-vv" "mount" "gdrive:" "/mnt/gdrive" "--allow-other" "--allow-non-empty" "--vfs-cache-mode" "writes"]
2021/10/03 21:12:47 DEBUG : Creating backend with remote "gdrive:"
2021/10/03 21:12:47 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2021/10/03 21:12:47 INFO  : GCS root: poll-interval is not supported by this remote
2021/10/03 21:12:47 DEBUG : vfs cache: root is "/root/.cache/rclone/vfs/gdrive"
2021/10/03 21:12:47 DEBUG : vfs cache: metadata root is "/root/.cache/rclone/vfs/gdrive"
2021/10/03 21:12:47 DEBUG : Creating backend with remote "/root/.cache/rclone/vfs/gdrive"
2021/10/03 21:12:47 DEBUG : Creating backend with remote "/root/.cache/rclone/vfsMeta/gdrive"
2021/10/03 21:12:47 DEBUG : GCS root: Mounting on "/mnt/gdrive"
2021/10/03 21:12:47 INFO  : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)

点评

我就是不知道怎么去守护进程,让它断掉后自动再运行起来  详情 回复 发表于 2021-10-20 08:29
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2021-10-20 08:29 | 显示全部楼层
siukong 发表于 2021-10-19 21:33
你运行完这段命令后,有没有任何返回提示?
我是这样写,会提示有点错误,但不影响mount成功. 在VPS上稳定运 ...

我就是不知道怎么去守护进程,让它断掉后自动再运行起来

点评

一个思路, 1.定期执行rclone lsd remote:path [flags], 连接正常会显示70GB GDrive字样显示远程网盘空间. 能显示则代表连接正常. 跳出脚本. 2.若不正常,运行rclone config reconnect remote: [flags], 重新连接.  详情 回复 发表于 2021-10-20 16:39
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-10-20 16:57 | 显示全部楼层
换openwrt包
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-25 08:56

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表