nc-nextcloud.sh, ncp-provisioning.sh: Implement nextcloud service workers

This commit is contained in:
Tobias Knöppler 2025-11-15 03:38:49 +01:00
parent 9c54a8a177
commit 5b11ae0caf
3 changed files with 50 additions and 0 deletions

View File

@ -82,5 +82,13 @@ EOF
cat /usr/local/etc/instance.cfg
}
systemctl is-enabled -q nextcloud-ai-worker@1.service || {
max="$(nproc || echo '2')"
max="$((max-1))"
for i in $(seq 1 "$max")
do
systemctl enable --now "nextcloud-ai-worker@${i}.service"
done
}
exit 0

View File

@ -83,6 +83,25 @@ EOF
update-rc.d redis-server enable
clear_opcache
# NC service workers
cat > /etc/systemd/system/nextcloud-ai-worker@.service <<'EOF'
[Unit]
Description=Nextcloud AI worker %i
After=network.target
[Service]
ExecStart=php occ background-job:worker -t 60 'OC\\TaskProcessing\\SynchronousBackgroundJob'
Restart=always
StartLimitInterval=60
StartLimitBurst=10
WorkingDirectory=/var/www/nextcloud
User=www-data
[Install]
WantedBy=multi-user.target
EOF
# service to randomize passwords on first boot
mkdir -p /usr/lib/systemd/system
cat > /usr/lib/systemd/system/nc-provisioning.service <<'EOF'

View File

@ -5,4 +5,27 @@ then
ncc app:disable app_api
fi
cat > /etc/systemd/system/nextcloud-ai-worker@.service <<'EOF'
[Unit]
Description=Nextcloud AI worker %i
After=network.target
[Service]
ExecStart=php occ background-job:worker -t 60 'OC\\TaskProcessing\\SynchronousBackgroundJob'
Restart=always
StartLimitInterval=60
StartLimitBurst=10
WorkingDirectory=/var/www/nextcloud
User=www-data
[Install]
WantedBy=multi-user.target
EOF
max="$(nproc || echo '2')"
max="$((max-1))"
for i in $(seq 1 "$max")
do
systemctl enable --now "nextcloud-ai-worker@${i}.service"
done
exit 0