Nextcloud自动清理回收站_nextcloud回收站自动清理-程序员宅基地

技术标签: 服务器  

Nextcloud自动清理回收站

注意,本文Nextcloud为snap安装的,如果是手动安装也不会麻烦那么多了。然后也没有添加www-data这样的用户对应该Nextcloud的权限,全是管理员权限,如和您安装的方式与设置不一样导致其它bug也是没办法的事。本文仅作自留档,毕竟已经折腾Nextcloud两次了。

首先是如果想手动清空的话,比如以下命令清空所有用户的回收站

sudo nextcloud.occ trashbin:cleanup -all-users

但如果要自动清除呢?以下参考https://www.shenqhy.com/nextcloud-clear-files_trashbin.html

博主的Nextcloud数据放在阿里的NAS下,突发奇想在阿里云手机客户端上查看了下用量,1.5个G,不科学啊。
进入NAS挂载目录,du逐层排查,发现是某账户文件夹下的files_trashbin文件夹占用了1.3个G
天天手动清理不累死
谷歌查找自动清理方法,在Nextcloud文档中发现,通过修改trashbin_retention_obligation参数为'auto,D'可自动清理超过D天的trashbin
遂添加

'trashbin_retention_obligation' => 'auto,3',

auto,3即为超过3天自动清理

保存后等待下一次Cron生效

转载请注明:神奇海域 » Nextcloud清理files_trashbin

官方文档对应部分如下:

Configuration Parameters

Nextcloud uses the config/config.php file to control server operations. config/config.sample.php lists all the configurable parameters within Nextcloud, along with example or default values. This document provides a more detailed reference. Most options are configurable on your Admin page, so it is usually not necessary to edit config/config.php.

Note

The installer creates a configuration containing the essential parameters. Only manually add configuration parameters to config/config.php if you need to use a special value for a parameter. Do not copy everything from config/config.sample.php . Only enter the parameters you wish to modify!

Deleted Items (trash bin)

These parameters control the Deleted files app.

'trashbin_retention_obligation' => 'auto',

If the trash bin app is enabled (default), this setting defines the policy for when files and folders in the trash bin will be permanently deleted.

The app allows for two settings, a minimum time for trash bin retention, and a maximum time for trash bin retention. Minimum time is the number of days a file will be kept, after which it may be deleted. Maximum time is the number of days at which it is guaranteed to be deleted. Both minimum and maximum times can be set together to explicitly define file and folder deletion. For migration purposes, this setting is installed initially set to “auto”, which is equivalent to the default setting in Nextcloud.

Available values:

    • auto

      default setting. keeps files and folders in the trash bin for 30 days and automatically deletes anytime after that if space is needed (note: files may not be deleted if space is not needed).

    • D, auto

      keeps files and folders in the trash bin for D+ days, delete anytime if space needed (note: files may not be deleted if space is not needed)

    • auto, D

      delete all files in the trash bin that are older than D days automatically, delete other files anytime if space needed

    • D1, D2

      keep files and folders in the trash bin for at least D1 days and delete when exceeds D2 days (note: files will not be deleted automatically if space is needed)

    • disabled

      trash bin auto clean disabled, files and folders will be kept forever

Defaults to auto

当然,我本来也想用nextcloud.occ直接配置,但想想可能会有奇怪的bug,还是直接修改php配置文件吧。自己找是不想找到,查询snap安装版本的Nextcloud的config/config.php的位置:

参考https://help.nextcloud.com/t/how-do-i-edit-the-config-php-file-on-a-nextcloud-box/12217/3中用户dev0的回答

dev0

May '17

Unfotunately that isn’t so easy in the ncbox as its installed with snap

i suggest you check the snap command on ssh

first do a snap list so you see which packages are installed

with snap refresh you can update your stuff but if you do that with nextcloud and the gap is too big, it will crash.

with snap info nextcloud you see the available commands:

  • nextcloud.disable-https
  • nextcloud.enable-https
  • nextcloud.manual-install
  • nextcloud.mysql-client
  • nextcloud.mysqldump
  • nextcloud.occ

i suggest you use the snap command to enable https because its better if its register that to the packet manager.

I have installed:

installed: 11.0.3snap1 (1288) 162MB -

so my config file which is applies should be this:

/var/snap/nextcloud/1288/nextcloud/config/config.php

there you can add the domain.

那好办,直接去我的/var/snap/nextcloud/current/nextcloud/config/config.php里修改就行。即添加'trashbin_retention_obligation' => 'auto,3',这一行,一般原来是没有这个配置的。


引用鸣谢:

  1. 神奇海域 » Nextcloud清理files_trashbin
  2. Nextcloud文档
  3. https://help.nextcloud.com/t/how-do-i-edit-the-config-php-file-on-a-nextcloud-box/12217/3
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_43598457/article/details/117367623

智能推荐

1. SimMechanics/Multibody入门-程序员宅基地

文章浏览阅读9.8k次,点赞43次,收藏167次。这篇博客主要介绍利用Matlab的SimMechanics/Multibody实现简单的单摆运动仿真。_simmechanics

Android 性能优化探究,作为移动开发程序员-程序员宅基地

文章浏览阅读870次,点赞22次,收藏28次。总之啊,家里没矿的同学们,如果你们想以后的日子过得好一些,多想想你们的业余时间怎么安排吧;技术方面的提升肯定是重中之重,但是技术外的一些“软实力”也不能完全忽视,很多时候升职确实是因为你的技术足够强,但也与你的“软实力”密切相关在这我也分享一份大佬自己收录整理的Android学习PDF+架构视频+面试文档+源码笔记,还有高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料这些都是我闲暇还会反复翻阅并给下属员工学习的精品资料。

Delphi防止多实例运行的两种方法《转》-程序员宅基地

文章浏览阅读83次。在学习Delphi时,遇到需要程序单实例运行的时候,经过查阅,暂时发现以下两种比较简单的方法,可以防止程序多实例运行,各有优劣,据需选择。方法一,添加以下unit即可,优点是可激活已存在的程序窗口,即使已最小化(包括最小化到托盘),缺点是可能存在与其他程序的互斥(可自行修改STR_UNIQUE的值以尽量减少该可能性)。代码如下://工程引用此单元就能防止同时出现多个实例u..._delphi 多实例

曼彻斯特编码与解码(含驱动源码)-程序员宅基地

文章浏览阅读875次,点赞27次,收藏23次。曼彻斯特编码方式, 这种编码方式利用信号的边沿来表示二进制数据“0”和“1”,比如信号的上身沿表示“1”,下降沿表示“0”,而这种跳变一般发生在位帧的中间。

2020 DevOps工程技术实践类教程-程序员宅基地

文章浏览阅读162次。你好,我是泽阳,在DevOps领域实践了多年,借助公司项目机会从端到端的对项目进行实施改造。在经过实践后,项目通过了信通院发布的《DevOps持续交付标准三级》评估。在此过程中不断的实施..._泽阳 devops

网安学习记录1 ms17010漏洞-程序员宅基地

文章浏览阅读56次。使用nmap对win7进行端口扫描。

随便推点

WPF DataGrid 单元格实现下拉框选项_wpf datagrid 双击编辑时变下拉列表-程序员宅基地

文章浏览阅读3.1k次,点赞11次,收藏2次。WPF DataGrid 单元格实现下拉框选项提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档文章目录WPF DataGrid 单元格实现下拉框选项前言一、问题二、示例1.实现效果2.描述三、解决方法四、总结前言需要实现DataGrid控件单元格下拉框选项,DataGrid数据来源是数据库中的表第一次写博客,尝试一下一、问题网上有很多关于DataGridComboBoxColumn以及DataGridTemplateColumn模板列的教程,需要在前台XAML中进行添加,这_wpf datagrid 双击编辑时变下拉列表

2023年互联网黑灰产研究年度报告-程序员宅基地

文章浏览阅读54次。下载报告去公众号:硬核刘大后台回复“黑灰产”,即可下载完整PDF文件。更多报告内容,可加微信:chanpin628领取。(ps:加过微信:chanpin628 的不要再加,分享的内容一样,有一个号就行。)申明:报告版权威胁猎人所有,此处仅限分享学习使用,如有侵权,请联系小编做删除处理。..._【威胁猎人】2023年互联网黑灰产研究年度报告.pdf

[C/C++]游戏地图制作_c++ 如何做地图-程序员宅基地

文章浏览阅读705次。利用二维数组实现游戏地图_c++ 如何做地图

Ubuntu 12.04.4 LTS 部署cap-程序员宅基地

文章浏览阅读715次。一.系统环境jim@mode:~$ cat /etc/issueUbuntu 12.04.4 LTS \n \ljim@mode:~$ uname -raLinux mode 3.11.0-15-generic#25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux二..._after this operation, 2,048 b of additional disk space will be used.

我见过最全的剖析QEMU原理的文章[Z]_no qemu-程序员宅基地

文章浏览阅读1.2w次。转自:http://people.cs.nctu.edu.tw/~chenwj/dokuwiki/doku.php?id=qemu How To Become A Hacker 写给新手程序员的一封信目录建置 QEMUUser ModeSPARCPowerP_no qemu

Dart —— 基础数据类型 Number String Boolean List Map Set Rune Symbol_dart number-程序员宅基地

文章浏览阅读714次。内建类型文章目录Dart 语言支持以下内建类型:NumberStringBooleanListSetMapRuneSymbolDart 语言支持以下内建类型:NumberStringBooleanList (也被称为 Array)MapSetRune (用于在字符串中表示 Unicode 字符)Symbol这些类型都可以被初始化为字面量。 例如, 'this is a s..._dart number