Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authornachoparker <nacho@ownyourbits.com>2018-04-10 13:38:45 +0300
committernachoparker <nacho@ownyourbits.com>2018-04-10 14:02:57 +0300
commit7081be39c96dd05a62a77d13ee26227bf8cc1e70 (patch)
tree3f79852ad195cdebce35b55ea15317d33ba6db6a /etc
parentc5221415d1532ec100a919220f557aa888d81f36 (diff)
docker: adapt ncp-apps to use cron instead of systemd timers
Diffstat (limited to 'etc')
-rw-r--r--etc/nextcloudpi-config.d/freeDNS.sh36
-rw-r--r--etc/nextcloudpi-config.d/nc-backup-auto.sh1
-rw-r--r--etc/nextcloudpi-config.d/nc-notify-updates.sh46
-rw-r--r--etc/nextcloudpi-config.d/nc-scan-auto.sh49
-rw-r--r--etc/nextcloudpi-config.d/spDYN.sh2
5 files changed, 34 insertions, 100 deletions
diff --git a/etc/nextcloudpi-config.d/freeDNS.sh b/etc/nextcloudpi-config.d/freeDNS.sh
index 12d52018..bffc98e1 100644
--- a/etc/nextcloudpi-config.d/freeDNS.sh
+++ b/etc/nextcloudpi-config.d/freeDNS.sh
@@ -27,25 +27,13 @@ install()
{
apt-get update
apt-get install --no-install-recommends -y dnsutils
- cat > /etc/systemd/system/freedns.service <<EOF
-[Unit]
-Description=FreeDNS client
-
-[Service]
-Type=simple
-ExecStart=/usr/local/bin/freedns.sh
-
-[Install]
-WantedBy=default.target
-EOF
}
configure()
{
[[ $ACTIVE_ != "yes" ]] && {
- systemctl stop freedns.timer
- systemctl disable freedns.timer
- systemctl daemon-reload
+ rm /etc/cron.d/freeDNS
+ service cron restart
echo "FreeDNS client is disabled"
return 0
}
@@ -63,25 +51,9 @@ echo "Registered IP: \$registeredIP | Current IP: \$currentIP"
EOF
chmod +744 /usr/local/bin/freedns.sh
+ echo "*/${UPDATEINTERVAL_} * * * * root /bin/bash /usr/local/bin/freedns.sh" > /etc/cron.d/freeDNS
+ service cron restart
- cat > /etc/systemd/system/freedns.timer <<EOF
-[Unit]
-Description=Timer to run FreeDNS client per interval
-
-[Timer]
-OnBootSec=${UPDATEINTERVAL_}min
-OnUnitActiveSec=${UPDATEINTERVAL_}min
-Unit=freedns.service
-
-[Install]
-WantedBy=timers.target
-EOF
- systemctl daemon-reload
-
- systemctl enable freedns.timer
- systemctl start freedns.timer
- systemctl start freedns.service
-
cd /var/www/nextcloud
sudo -u www-data php occ config:system:set trusted_domains 3 --value="$DOMAIN_"
sudo -u www-data php occ config:system:set overwrite.cli.url --value=https://"$DOMAIN_"
diff --git a/etc/nextcloudpi-config.d/nc-backup-auto.sh b/etc/nextcloudpi-config.d/nc-backup-auto.sh
index 0fc6e541..d785eac9 100644
--- a/etc/nextcloudpi-config.d/nc-backup-auto.sh
+++ b/etc/nextcloudpi-config.d/nc-backup-auto.sh
@@ -26,6 +26,7 @@ configure()
{
[[ $ACTIVE_ != "yes" ]] && {
rm /etc/cron.d/ncp-backup-auto
+ service cron restart
echo "automatic backups disabled"
return 0
}
diff --git a/etc/nextcloudpi-config.d/nc-notify-updates.sh b/etc/nextcloudpi-config.d/nc-notify-updates.sh
index f24897d4..9d8e473d 100644
--- a/etc/nextcloudpi-config.d/nc-notify-updates.sh
+++ b/etc/nextcloudpi-config.d/nc-notify-updates.sh
@@ -15,33 +15,18 @@
ACTIVE_=yes
USER_=admin
-CHECKINTERVAL=60
+
DESCRIPTION="Notify in NC when a NextCloudPi update is available"
+# check every hour
+CHECKINTERVAL=1
NCDIR=/var/www/nextcloud
-install()
-{
- # timers
- cat > /etc/systemd/system/nc-notify-updates.service <<EOF
-[Unit]
-Description=Notify in NC when a NextCloudPi update is available
-
-[Service]
-Type=simple
-ExecStart=/usr/local/bin/ncp-notify-update
-ExecStartPost=/usr/local/bin/ncp-notify-unattended-upgrade
-
-[Install]
-WantedBy=default.target
-EOF
-}
-
configure()
{
[[ $ACTIVE_ != "yes" ]] && {
- systemctl stop nc-notify-updates.timer
- systemctl disable nc-notify-updates.timer
+ rm /etc/cron.d/ncp-notify-updates
+ service cron restart
echo "update web notifications disabled"
return 0
}
@@ -103,26 +88,15 @@ sudo -u www-data php /var/www/nextcloud/occ notification:generate \
EOF
chmod +x /usr/local/bin/ncp-notify-unattended-upgrade
- # timer
- cat > /etc/systemd/system/nc-notify-updates.timer <<EOF
-[Unit]
-Description=Timer notify NCP updates in browser
+ # check every hour at 40th minute
+ echo "40 */${CHECKINTERVAL} * * * root /usr/local/bin/ncp-notify-update && /usr/local/bin/ncp-notify-unattended-upgrade" > /etc/cron.d/ncp-notify-updates
+ service cron restart
-[Timer]
-OnBootSec=${CHECKINTERVAL}min
-OnUnitActiveSec=${CHECKINTERVAL}min
-Unit=nc-notify-updates.service
-
-[Install]
-WantedBy=timers.target
-EOF
-
- systemctl daemon-reload
- systemctl enable nc-notify-updates.timer
- systemctl start nc-notify-updates.timer
echo "update web notifications enabled"
}
+install() { :; }
+
# License
#
# This script is free software; you can redistribute it and/or modify it
diff --git a/etc/nextcloudpi-config.d/nc-scan-auto.sh b/etc/nextcloudpi-config.d/nc-scan-auto.sh
index f5cca603..87d772a4 100644
--- a/etc/nextcloudpi-config.d/nc-scan-auto.sh
+++ b/etc/nextcloudpi-config.d/nc-scan-auto.sh
@@ -22,49 +22,36 @@ INFO="Set the time in minutes in SCANINTERVAL.
>>> If there are too many files this can greatly affect performance. <<<"
-install()
-{
- cat > /etc/systemd/system/nc-scan.service <<EOF
-[Unit]
-Description=Scan NC for externally modified files
-
-[Service]
-Type=simple
-ExecStart=/usr/local/bin/ncp-scan
-
-[Install]
-WantedBy=default.target
-EOF
-}
-
configure()
{
[[ $ACTIVE_ != "yes" ]] && {
- systemctl stop nc-scan.timer
- systemctl disable nc-scan.timer
+ rm /etc/cron.d/ncp-scan-auto
+ service cron restart
echo "automatic scans disabled"
return 0
}
- cat > /etc/systemd/system/nc-scan.timer <<EOF
-[Unit]
-Description=Timer to scan NC for externally modified files
-
-[Timer]
-OnBootSec=${SCANINTERVAL_}min
-OnUnitActiveSec=${SCANINTERVAL_}min
-Unit=nc-scan.service
+ # set crontab
+ local DAYS HOURS MINS
+ DAYS=$(( SCANINTERVAL_ / 1440 ))
+ if [[ "$DAYS" != "0" ]]; then
+ DAYS="*/$DAYS" HOUR="1" MINS="15"
+ else
+ DAYS="*"
+ HOUR=$(( SCANINTERVAL_ / 60 ))
+ MINS=$(( SCANINTERVAL_ % 60 ))
+ MINS="*/$MINS"
+ [[ $HOUR == 0 ]] && HOUR="*" || { HOUR="*/$HOUR" MINS="15"; }
+ fi
-[Install]
-WantedBy=timers.target
-EOF
+ echo "${MINS} ${HOUR} ${DAYS} * * root /usr/local/bin/ncp-scan" > /etc/cron.d/ncp-scan-auto
+ service cron restart
- systemctl daemon-reload
- systemctl enable nc-scan.timer
- systemctl start nc-scan.timer
echo "automatic scans enabled"
}
+install() { :; }
+
# License
#
# This script is free software; you can redistribute it and/or modify it
diff --git a/etc/nextcloudpi-config.d/spDYN.sh b/etc/nextcloudpi-config.d/spDYN.sh
index 7139354d..8a929d32 100644
--- a/etc/nextcloudpi-config.d/spDYN.sh
+++ b/etc/nextcloudpi-config.d/spDYN.sh
@@ -131,7 +131,7 @@ configure()
rm -f "$CRONFILE"
echo "spdnsUpdater is now disabled"
fi
- systemctl restart cron
+ service cron restart
}
# License