Skip to content

Commit

Permalink
Merge pull request #4 from jum/develop
Browse files Browse the repository at this point in the history
Add nextcloud cron.sh and occ.sh scripts.
  • Loading branch information
jum authored Jul 14, 2024
2 parents 6c10064 + a1dcd9d commit 06a60ec
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,20 @@ configuration relies on the .php files to be present under the same path
in both the caddy and the nextcloud containers, note the according volume
mounts of /var/www/html in both containers.

The docker compose file configures to use redis storage for PHP sessions,
I additionally configure the same redis instance as cache and locking
backend in my config.php. I do seperate nextcloud caching into it's own
redis database number, as nextcloud does not expire old entries and an
occasional "delete *" is in order (preferably after an upgrade) to keep
the redis storage down.

Additionally you might want to use the occ.sh and cron.sh scripts. The
cron.sh script triggers background jobs inside the nextcloud container, see
the nextcloud.timer and nextcloud.service files for a systemd configuration.

The occ.sh script us used to trigger nextcloud command line functions for
administrative management of the nextcloud instance.

## Backup

I do run nightly backups via restic to a Hetzner storage box via SFTP.
Expand Down
6 changes: 6 additions & 0 deletions nextcloud/cron.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
if test -t 0
then
ARGS=-t
fi
docker exec --user www-data -i $ARGS nextcloud sh -c "exec php cron.php"
11 changes: 11 additions & 0 deletions nextcloud/nextcloud.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Run nextcloud cron
Wants=nextcloud.timer

[Service]
Type=oneshot
ExecStart=/home/adminuser/web/nextcloud/cron.sh
Environment="HOME=/home/adminuser"

[Install]
WantedBy=multi-user.target
9 changes: 9 additions & 0 deletions nextcloud/nextcloud.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Start nextcloud cron job

[Timer]
Unit=nextcloud.service
OnCalendar=*:0/5

[Install]
WantedBy=timers.target
6 changes: 6 additions & 0 deletions nextcloud/occ.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
if test -t 0
then
ARGS=-t
fi
docker exec --user www-data -i $ARGS nextcloud sh -c "exec php occ $*"

0 comments on commit 06a60ec

Please sign in to comment.