Skip to content

Commit 5b11ae0

Browse files
committed
nc-nextcloud.sh, ncp-provisioning.sh: Implement nextcloud service workers
1 parent 9c54a8a commit 5b11ae0

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

bin/ncp-provisioning.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,13 @@ EOF
8282
cat /usr/local/etc/instance.cfg
8383
}
8484

85+
systemctl is-enabled -q [email protected] || {
86+
max="$(nproc || echo '2')"
87+
max="$((max-1))"
88+
for i in $(seq 1 "$max")
89+
do
90+
systemctl enable --now "nextcloud-ai-worker@${i}.service"
91+
done
92+
}
8593

8694
exit 0

bin/ncp/CONFIG/nc-nextcloud.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,25 @@ EOF
8383
update-rc.d redis-server enable
8484
clear_opcache
8585

86+
# NC service workers
87+
cat > /etc/systemd/system/[email protected] <<'EOF'
88+
[Unit]
89+
Description=Nextcloud AI worker %i
90+
After=network.target
91+
92+
[Service]
93+
ExecStart=php occ background-job:worker -t 60 'OC\\TaskProcessing\\SynchronousBackgroundJob'
94+
Restart=always
95+
StartLimitInterval=60
96+
StartLimitBurst=10
97+
WorkingDirectory=/var/www/nextcloud
98+
User=www-data
99+
100+
[Install]
101+
WantedBy=multi-user.target
102+
EOF
103+
104+
86105
# service to randomize passwords on first boot
87106
mkdir -p /usr/lib/systemd/system
88107
cat > /usr/lib/systemd/system/nc-provisioning.service <<'EOF'

updates/1.56.0.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,27 @@ then
55
ncc app:disable app_api
66
fi
77

8+
cat > /etc/systemd/system/[email protected] <<'EOF'
9+
[Unit]
10+
Description=Nextcloud AI worker %i
11+
After=network.target
12+
13+
[Service]
14+
ExecStart=php occ background-job:worker -t 60 'OC\\TaskProcessing\\SynchronousBackgroundJob'
15+
Restart=always
16+
StartLimitInterval=60
17+
StartLimitBurst=10
18+
WorkingDirectory=/var/www/nextcloud
19+
User=www-data
20+
21+
[Install]
22+
WantedBy=multi-user.target
23+
EOF
24+
max="$(nproc || echo '2')"
25+
max="$((max-1))"
26+
for i in $(seq 1 "$max")
27+
do
28+
systemctl enable --now "nextcloud-ai-worker@${i}.service"
29+
done
30+
831
exit 0

0 commit comments

Comments
 (0)