备份机器的内存使用太高
A虚拟机做了一个nextcloud,搭建了私有网盘。
B虚拟机同样的系统环境,作为nextcloud的备份盘。
A机器计划任务执行的rsync
cat /etc/crontab
* 1 * * * root /var/www/sql/bak.sh
cat /var/www/sql/bak.sh
#! /bin/bash
a=`date +%y-%m-%d`
mysqldump -uroot -proot nextcloud_db > /var/www/sql/$a.sql
rsync -avz --delete /var/www linx00:/var &> /dev/null
使用后,隔了几周,查看B机器,free,16G内存竟然被占满了,
通过 ps -ef | grep rsync,几天前 的命令还存在一直占用内存空间。
通过释放未能解决,后来重启释放。。。。。(未解决)
后台创建的文件,如何Nextcloud中显示
OCC(ownCloud console)是ownCloud的命令行工具(也用于Nextcloud),OCC文件默认情况下在nextCloud/ownCloud的根目录下
(A机器安装在/var/www/nextcloud)
Files:scan的用法:
格式:
files:scan [-p|--path="..."] [-q|--quiet] [-v|vv|vvv --verbose] [--all] [user_id1] ... [user_idN]
user_id #扫描所指定的用户(一个或多个,多个用户ID之间要使用空格分开)的所有文件
选项:
--path #限制扫描路径
--all #扫描所有已知用户的所有文件
--quiet #不输出统计信息
--verbose #在扫描过程中显示正在处理的文件和目录
--unscanned #仅扫描以前未扫描过的文件
扫描所有用户的所有文件具体命令:
sudo -u www-data php occ files:scan --all
扫描所有用户的所有文件,www-data是文件拥有者的用户名,哪个用户启动的Web服务器,所有者就是谁,就填写谁的名字。
OCC文件位于nextCloud的根目录下,如果当前目录不是nextCloud的根目录,则需要补全OCC的路径。
如果你给OCC文件添加了可执行权限,那我们的命令里面可以省略php,OCC文件开头已经指定了由php执行。
机器测试如下
root@A:/var/www/nextcloud# ls
3rdparty console.php data *occ* public.php settings version.php
apps COPYING index.html ocm-provider remote.php status.php
AUTHORS core index.php ocs resources themes
config cron.php lib ocs-provider robots.txt updater
##进入文件存放位置
root@Linx:/var/www/nextcloud/data/admin/files# touch aaaa
### 查看其他文件所属是netadmin,也将aaaa更换为netadmin
root@Linx:/var/www/nextcloud/data/admin/files# chown netadmin:netadmin aaaa
root@Linx:/var/www/nextcloud/data/admin/files# ls -al
总用量 3080
drwxr-xr-x 7 netadmin netadmin 4096 3月 30 15:54 .
drwxr-xr-x 7 netadmin netadmin 4096 1月 11 15:04 ..
-rw-r--r-- 1 netadmin netadmin 0 3月 30 15:54 aaaa
root@Linx:/var/www/nextcloud# sudo -u netadmin occ files:scan --all
sudo:occ:找不到命令
root@Linx:/var/www/nextcloud# sudo -u netadmin php occ files:scan --all
Starting scan for user 1 out of 45 (admin)
Starting scan for user 2 out of 45 (bbzhu)
Starting scan for user 3 out of 45 (dzwang)
Starting scan for user 4 out of 45 (ffliu)
Starting scan for user 5 out of 45 (hguo)
Starting scan for user 6 out of 45 (hmcao)
Starting scan for user 7 out of 45 (hxcao)
Starting scan for user 8 out of 45 (jcyang)
Starting scan for user 9 out of 45 (jczhang)
Starting scan for user 10 out of 45 (jplv)
Starting scan for user 11 out of 45 (jwzou)
Starting scan for user 12 out of 45 (jyshi)
Starting scan for user 13 out of 45 (lshou)
Starting scan for user 14 out of 45 (lzhu)
Starting scan for user 15 out of 45 (mli)
Starting scan for user 16 out of 45 (mxie)
Starting scan for user 17 out of 45 (pcsong)
Starting scan for user 18 out of 45 (pzhang)
Starting scan for user 19 out of 45 (qjhuang)
Starting scan for user 20 out of 45 (scfu)
Starting scan for user 21 out of 45 (sqzhou)
Starting scan for user 22 out of 45 (ssxu)
Starting scan for user 23 out of 45 (stao)
Starting scan for user 24 out of 45 (swang)
Starting scan for user 25 out of 45 (syang)
Starting scan for user 26 out of 45 (tczhang)
Starting scan for user 27 out of 45 (tjzhang)
Starting scan for user 28 out of 45 (wlliu)
Starting scan for user 29 out of 45 (wwwu)
Starting scan for user 30 out of 45 (wzhang)
Starting scan for user 31 out of 45 (xfye)
Starting scan for user 32 out of 45 (xlin)
Starting scan for user 33 out of 45 (xmwu)
Starting scan for user 34 out of 45 (xpzhu)
Starting scan for user 35 out of 45 (xwliu)
Starting scan for user 36 out of 45 (ychi)
Starting scan for user 37 out of 45 (ydai)
Starting scan for user 38 out of 45 (yfzhao)
Starting scan for user 39 out of 45 (yguo)
Starting scan for user 40 out of 45 (yren)
Starting scan for user 41 out of 45 (yrli)
Starting scan for user 42 out of 45 (ysji)
Starting scan for user 43 out of 45 (z)
Starting scan for user 44 out of 45 (zfeng)
Starting scan for user 45 out of 45 (zmgu)
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 540 | 1234 | 00:00:02 |
+---------+-------+--------------+
后去网页上查看,已正常显示aaaa