Implement nextcloudcron systemd timer.

This commit is contained in:
Andreas B. Mundt 2020-01-16 18:56:32 +01:00
parent 97e980fbf7
commit 0f9e8d2124
4 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,6 @@
[Unit]
Description=Nextcloud cron.php job
[Service]
User=www-data
ExecStart=/usr/bin/php -f /var/www/nextcloud/cron.php

View file

@ -0,0 +1,10 @@
[Unit]
Description=Run Nextcloud cron.php every 5 minutes
[Timer]
OnBootSec=5min
OnUnitActiveSec=5min
Unit=nextcloudcron.service
[Install]
WantedBy=timers.target

View file

@ -9,3 +9,10 @@
name: php{{ php_ver.stdout }}-fpm
state: restarted
listen: "restart php-fpm"
- name: enable nextcloudcron.service and .timer
systemd:
name: nextcloudcron.timer
state: started
enabled: True
listen: "enable nextcloudcron.service"

View file

@ -199,3 +199,28 @@
chdir: "{{ nc_dir }}"
warn: False
when: not notes.stat.exists
## nextcloudcron
- name: provide nextcloudcron.service and .timer
copy:
src: "{{ item }}"
dest: "/etc/systemd/system/{{ item }}"
with_items:
- nextcloudcron.service
- nextcloudcron.timer
register: nextcloudcron
notify: "enable nextcloudcron.service"
- name: switch to systemd timer
command: sudo -u www-data php ./occ background:cron
args:
chdir: "{{ nc_dir }}"
warn: False
when: nextcloudcron.changed
## ToDo kerberox integration:
# sudo -u www-data php ./occ app:enable user_ldap
# sudo -u www-data php ./occ app:install user_saml
# sudo -u www-data php ./occ ldap