Nextcloud background jobs settings

24/04/2022 1287点热度 0条评论

(Background job execution is frist execution in this image)

( Background job 异常是图中第一个警告)

 

It is recommended to refer to the Nextcloud developer manual for operation

建议参考 Nextcloud 开发者手册操作

https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/background_jobs_configuration.html#parameters

 

Nextcloud 的后台任务运行方式有三种 综合考虑建议 Cron or systemd

二选一,只需要安装一个即可

Cron:

这里的 "www-data" 替换成你的 Web 服务器用户

crontab -u www-data -e

输入如下内容,并保存。(路径替换为你的 cron.php 路径)

*/5  *  *  *  * php -f /var/www/nextcloud/cron.php

查看计时器是否正常

crontab -u nginx -l

运行正常会返回如下结果

*/5  *  *  *  * php -f /var/www/nextcloud/cron.php

 

systemd:

cd /etc/systemd/system/

创建 service 并编辑,保存

vim nextcloudcron.service

"www-data"替换为 Web 服务器用户

[Unit]
Description=Run Nextcloud cron.php every 5 minutes

[Timer]
OnBootSec=5min
OnUnitActiveSec=5min
Unit=nextcloudcron.service

[Install]
WantedBy=timers.target

创建 timer 并编辑,保存

vim nextcloudcron.timer
[Unit]
Description=Run Nextcloud cron.php every 5 minutes

[Timer]
OnBootSec=5min
OnUnitActiveSec=5min
Unit=nextcloudcron.service

[Install]
WantedBy=timers.target

启动计时器

systemctl enable --now nextcloudcron.timer

 

pen Lens

这个人很懒,什么都没留下

文章评论