Initial commit

This commit is contained in:
Alexandre CATTEAU 2022-05-22 11:45:24 +02:00
commit c90f49ee70
5 changed files with 49 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
variables.conf
.disabled

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# Nextcloud's cron job timer
This repository contains Systemd service and timer basic units to run Nextcloud's own cron job regularly (as recommended in the
[official documentation](https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/background_jobs_configuration.html#systemd)).
### Files
* `cloud-cron.service` is the service file executing Nextcloud's PHP cron job
* `cloud-cron.timer` is the timer starting the service every 5 minutes
#### Installation
* `install.sh` script copies Systemd units to their destination, and enables timer.
### TODO
* RAS

6
cloud-cron.service Normal file
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

9
cloud-cron.timer Normal file
View File

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

19
install.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
run_directory=$(dirname "$0")
if [ -f $run_directory/.disabled ]; then
echo "Installation is disabled. Exiting..."
exit 0
fi
echo "Copying Systemd units to system directory..."
sudo cp $run_directory/cloud-cron.service $run_directory/cloud-cron.timer /etc/systemd/system/
echo "Reloading Systemd..."
sudo systemctl daemon-reload
echo "Enabling timer (not starting it, either do it manually or reboot)..."
sudo systemctl enable cloud-cron.timer
echo "Finished install. Exiting..."
exit 0