Nextcloud server-side maintenance and automation
Hosting your own instance of Nextcloud offers the additionl advantage of server-side scripting and task automation.
Server-side commands
Navigate to the Nextcloud installation directory server-side
The occ
command line utility is used by navigating to the root installation folder of your Nextcloud instance and,
using your appropriate web-user
and php
installation, run as outlined below:
www-data
, php7.4
and username
may be substituted for values appropriate to your installation.
List available commands
Notable commands
Requires maintenance:mode --off
:
sharing:cleanup-remote-storages
trashbin:cleanup --all-users
Can be run with maintenance:mode --on
:
update:check
app:update --all
maintenance:mode --on\off
notification:generate **username** "255 char message" -l "4000 char optional message"
background:cron
For a Nextcloud 20 installation, the argument flags are explained in detail in the official documentation.
Assigning commands to cron
For a general crontab generator, see the crontab guru page. Below are some useful examples.
Nextcloud standard cron running every 15 mins:
*/15 * * * * sudo -u www-data php /var/www/NEXTCLOUD/cron.php
Material on this site is licensed under a Creative Commons BY-NC-SA 4.0 license unless specified otherwise.