From e022624194061c8c5df36058ee565f27126bb748 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sun, 30 Jul 2023 01:16:35 -0500 Subject: [PATCH 1/5] standard cron Signed-off-by: Eric Nemchik --- root/defaults/crontabs/abc | 2 ++ root/etc/crontabs/root | 9 -------- ...it-crontabs-config => init-crontab-config} | 0 .../dependencies.d/init-nextcloud-config | 0 .../s6-rc.d/init-crontab-config/run | 22 ++++++++++++++++++ .../type | 0 .../s6-overlay/s6-rc.d/init-crontab-config/up | 1 + .../s6-rc.d/init-crontabs-config/run | 23 ------------------- .../s6-rc.d/init-crontabs-config/up | 1 - ...it-crontabs-config => init-crontab-config} | 0 10 files changed, 25 insertions(+), 33 deletions(-) create mode 100644 root/defaults/crontabs/abc delete mode 100644 root/etc/crontabs/root rename root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/{init-crontabs-config => init-crontab-config} (100%) rename root/etc/s6-overlay/s6-rc.d/{init-crontabs-config => init-crontab-config}/dependencies.d/init-nextcloud-config (100%) create mode 100644 root/etc/s6-overlay/s6-rc.d/init-crontab-config/run rename root/etc/s6-overlay/s6-rc.d/{init-crontabs-config => init-crontab-config}/type (100%) create mode 100644 root/etc/s6-overlay/s6-rc.d/init-crontab-config/up delete mode 100755 root/etc/s6-overlay/s6-rc.d/init-crontabs-config/run delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-crontabs-config/up rename root/etc/s6-overlay/s6-rc.d/user/contents.d/{init-crontabs-config => init-crontab-config} (100%) diff --git a/root/defaults/crontabs/abc b/root/defaults/crontabs/abc new file mode 100644 index 00000000..a9847bfc --- /dev/null +++ b/root/defaults/crontabs/abc @@ -0,0 +1,2 @@ +# min hour day month weekday command +*/5 * * * * /usr/bin/php /app/www/public/cron.php 2>&1 diff --git a/root/etc/crontabs/root b/root/etc/crontabs/root deleted file mode 100644 index 804eb033..00000000 --- a/root/etc/crontabs/root +++ /dev/null @@ -1,9 +0,0 @@ -# do daily/weekly/monthly maintenance -# min hour day month weekday command -*/15 * * * * run-parts /etc/periodic/15min -0 * * * * run-parts /etc/periodic/hourly -0 2 * * * run-parts /etc/periodic/daily -0 3 * * 6 run-parts /etc/periodic/weekly -0 5 1 * * run-parts /etc/periodic/monthly -# nextcloud cron -*/5 * * * * s6-setuidgid abc php -f /app/www/public/cron.php diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-crontabs-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-crontab-config similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-crontabs-config rename to root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-crontab-config diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/dependencies.d/init-nextcloud-config b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/dependencies.d/init-nextcloud-config similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-crontabs-config/dependencies.d/init-nextcloud-config rename to root/etc/s6-overlay/s6-rc.d/init-crontab-config/dependencies.d/init-nextcloud-config diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/run b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/run new file mode 100644 index 00000000..c49a50c5 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/run @@ -0,0 +1,22 @@ +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +# make folders +mkdir -p \ + /config/crontabs + +## abc +# if crontabs do not exist in config +if [[ ! -f /config/crontabs/abc ]]; then + # copy crontab from system + if crontab -l -u abc; then + crontab -l -u abc >/config/crontabs/abc + fi + + # if crontabs still do not exist in config (were not copied from system) + # copy crontab from included defaults (using -n, do not overwrite an existing file) + cp -n /defaults/crontabs/abc /config/crontabs/ +fi +# set permissions and import user crontabs +lsiown abc:abc /config/crontabs/abc +crontab -u abc /config/crontabs/abc diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/type b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/type similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-crontabs-config/type rename to root/etc/s6-overlay/s6-rc.d/init-crontab-config/type diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/up b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/up new file mode 100644 index 00000000..d3541118 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-crontab-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/run b/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/run deleted file mode 100755 index 45f3844a..00000000 --- a/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/run +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/with-contenv bash -# shellcheck shell=bash - -# make folders -mkdir -p \ - /config/crontabs - -## root -# if crontabs do not exist in config -if [[ ! -f /config/crontabs/root ]]; then - # copy crontab from system - if crontab -l -u root; then - crontab -l -u root >/config/crontabs/root - fi - - # if crontabs still do not exist in config (were not copied from system) - # copy crontab from included defaults (using -n, do not overwrite an existing file) - cp -n /etc/crontabs/root /config/crontabs/ -fi -sed -i "s|s6-setuidgid abc php[0-9]* -f /config/www/nextcloud/cron.php|s6-setuidgid abc php -f /app/www/public/cron.php|" /config/crontabs/root -# set permissions and import user crontabs -lsiown root:root /config/crontabs/root -crontab -u root /config/crontabs/root diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/up b/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/up deleted file mode 100644 index 006d8141..00000000 --- a/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/up +++ /dev/null @@ -1 +0,0 @@ -/etc/s6-overlay/s6-rc.d/init-crontabs-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-crontabs-config b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-crontab-config similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/user/contents.d/init-crontabs-config rename to root/etc/s6-overlay/s6-rc.d/user/contents.d/init-crontab-config From 0d3c4888b002010bc80a3a1b8eef2e2275781fd4 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sun, 30 Jul 2023 09:49:46 -0500 Subject: [PATCH 2/5] Fix perms Signed-off-by: Eric Nemchik --- root/etc/s6-overlay/s6-rc.d/init-crontab-config/run | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 root/etc/s6-overlay/s6-rc.d/init-crontab-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/run b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/run old mode 100644 new mode 100755 From 31e9e86b4f82a87e48f181f71a42bfb7a769884d Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Fri, 18 Aug 2023 23:38:05 -0500 Subject: [PATCH 3/5] cron in base Signed-off-by: Eric Nemchik --- .../dependencies.d/init-crontab-config | 0 .../dependencies.d/init-nextcloud-config | 0 .../s6-rc.d/init-crontab-config/run | 22 ------------------- .../s6-rc.d/init-crontab-config/type | 1 - .../s6-overlay/s6-rc.d/init-crontab-config/up | 1 - .../user/contents.d/init-crontab-config | 0 6 files changed, 24 deletions(-) delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-crontab-config rename root/etc/s6-overlay/s6-rc.d/{init-crontab-config => init-config-end}/dependencies.d/init-nextcloud-config (100%) delete mode 100755 root/etc/s6-overlay/s6-rc.d/init-crontab-config/run delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-crontab-config/type delete mode 100644 root/etc/s6-overlay/s6-rc.d/init-crontab-config/up delete mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/init-crontab-config diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-crontab-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-crontab-config deleted file mode 100644 index e69de29b..00000000 diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/dependencies.d/init-nextcloud-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-nextcloud-config similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-crontab-config/dependencies.d/init-nextcloud-config rename to root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-nextcloud-config diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/run b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/run deleted file mode 100755 index c49a50c5..00000000 --- a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/run +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/with-contenv bash -# shellcheck shell=bash - -# make folders -mkdir -p \ - /config/crontabs - -## abc -# if crontabs do not exist in config -if [[ ! -f /config/crontabs/abc ]]; then - # copy crontab from system - if crontab -l -u abc; then - crontab -l -u abc >/config/crontabs/abc - fi - - # if crontabs still do not exist in config (were not copied from system) - # copy crontab from included defaults (using -n, do not overwrite an existing file) - cp -n /defaults/crontabs/abc /config/crontabs/ -fi -# set permissions and import user crontabs -lsiown abc:abc /config/crontabs/abc -crontab -u abc /config/crontabs/abc diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/type b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/type deleted file mode 100644 index bdd22a18..00000000 --- a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/type +++ /dev/null @@ -1 +0,0 @@ -oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/up b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/up deleted file mode 100644 index d3541118..00000000 --- a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/up +++ /dev/null @@ -1 +0,0 @@ -/etc/s6-overlay/s6-rc.d/init-crontab-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-crontab-config b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-crontab-config deleted file mode 100644 index e69de29b..00000000 From a7471ca0978788f92b657a9d7413f7c508a439a8 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sat, 19 Aug 2023 08:41:47 -0500 Subject: [PATCH 4/5] Remove root cron sed Signed-off-by: Eric Nemchik --- root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run | 1 - 1 file changed, 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run index 9e47ceb1..c1bcbc2a 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run @@ -21,7 +21,6 @@ if [ -f /config/www/nextcloud/version.php ]; then ! -path "/config/www/nextcloud/config" \ ! -path "/config/www/nextcloud/themes" \ -delete - sed -i "s|/config/www/nextcloud/cron.php|/app/www/public/cron.php|g" /config/crontabs/root touch /config/www/nextcloud/config/needs_migration fi From e25b4e3b4f475c800f2783fc0edc1d107f832f54 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sat, 19 Aug 2023 10:17:19 -0500 Subject: [PATCH 5/5] Move crontabs to etc Signed-off-by: Eric Nemchik --- root/{defaults => etc}/crontabs/abc | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename root/{defaults => etc}/crontabs/abc (100%) diff --git a/root/defaults/crontabs/abc b/root/etc/crontabs/abc similarity index 100% rename from root/defaults/crontabs/abc rename to root/etc/crontabs/abc