From cd411dd7d808c46461f4b2b7368d3ef9134f06e1 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sun, 30 Jul 2023 01:13:37 -0500 Subject: [PATCH 1/5] standard cron Signed-off-by: Eric Nemchik --- root/app/feed2toot-cron.sh | 2 +- root/defaults/crontabs/abc | 2 ++ root/etc/crontabs/root | 1 - .../{init-crontabs-config => init-crontab-config} | 0 .../dependencies.d/init-feed2toot-config | 0 .../run | 14 +++++++------- .../type | 0 root/etc/s6-overlay/s6-rc.d/init-crontab-config/up | 1 + .../etc/s6-overlay/s6-rc.d/init-crontabs-config/up | 1 - root/etc/s6-overlay/s6-rc.d/svc-cron/run | 2 +- .../{init-crontabs-config => init-crontab-config} | 0 11 files changed, 12 insertions(+), 11 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-feed2toot-config (100%) rename root/etc/s6-overlay/s6-rc.d/{init-crontabs-config => init-crontab-config}/run (60%) mode change 100755 => 100644 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 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/app/feed2toot-cron.sh b/root/app/feed2toot-cron.sh index 8332594..7c2d456 100755 --- a/root/app/feed2toot-cron.sh +++ b/root/app/feed2toot-cron.sh @@ -1,4 +1,4 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -s6-setuidgid abc python3 /lsiopy/bin/feed2toot -l "${FEED_LIMIT:-5}" -c /config/feed2toot.ini +python3 /lsiopy/bin/feed2toot -l "${FEED_LIMIT:-5}" -c /config/feed2toot.ini diff --git a/root/defaults/crontabs/abc b/root/defaults/crontabs/abc new file mode 100644 index 0000000..9af3f3c --- /dev/null +++ b/root/defaults/crontabs/abc @@ -0,0 +1,2 @@ +# min hour day month weekday command +*/15 * * * * /app/feed2toot-cron.sh 2>&1 diff --git a/root/etc/crontabs/root b/root/etc/crontabs/root deleted file mode 100644 index fca22f4..0000000 --- a/root/etc/crontabs/root +++ /dev/null @@ -1 +0,0 @@ -*/15 * * * * /app/feed2toot-cron.sh 2>&1 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-feed2toot-config b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/dependencies.d/init-feed2toot-config similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-crontabs-config/dependencies.d/init-feed2toot-config rename to root/etc/s6-overlay/s6-rc.d/init-crontab-config/dependencies.d/init-feed2toot-config diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/run b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/run old mode 100755 new mode 100644 similarity index 60% rename from root/etc/s6-overlay/s6-rc.d/init-crontabs-config/run rename to root/etc/s6-overlay/s6-rc.d/init-crontab-config/run index 1080bb6..c49a50c --- a/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-crontab-config/run @@ -5,18 +5,18 @@ mkdir -p \ /config/crontabs -## root +## abc # if crontabs do not exist in config -if [[ ! -f /config/crontabs/root ]]; then +if [[ ! -f /config/crontabs/abc ]]; then # copy crontab from system - if crontab -l -u root; then - crontab -l -u root >/config/crontabs/root + 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 /etc/crontabs/root /config/crontabs/ + cp -n /defaults/crontabs/abc /config/crontabs/ fi # set permissions and import user crontabs -lsiown root:root /config/crontabs/root -crontab -u root /config/crontabs/root +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 0000000..d354111 --- /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/up b/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/up deleted file mode 100644 index 006d814..0000000 --- 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/svc-cron/run b/root/etc/s6-overlay/s6-rc.d/svc-cron/run index 5eaadfd..ccc3374 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-cron/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-cron/run @@ -1,4 +1,4 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash -exec /usr/sbin/crond -f -S -l 5 +exec busybox crond -f -S -l 5 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 a495a1696bcb902234b68e24dc094e1fe9f7f4d8 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sun, 30 Jul 2023 09:49:03 -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 5787a6220231dde87a79acb6e3e80dff3f7e3126 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Fri, 18 Aug 2023 23:06:52 -0500 Subject: [PATCH 3/5] cron in base Signed-off-by: Eric Nemchik --- .../s6-overlay/s6-rc.d/svc-cron/dependencies.d/init-services | 0 root/etc/s6-overlay/s6-rc.d/svc-cron/run | 4 ---- root/etc/s6-overlay/s6-rc.d/svc-cron/type | 1 - root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-cron | 0 4 files changed, 5 deletions(-) delete mode 100644 root/etc/s6-overlay/s6-rc.d/svc-cron/dependencies.d/init-services delete mode 100755 root/etc/s6-overlay/s6-rc.d/svc-cron/run delete mode 100644 root/etc/s6-overlay/s6-rc.d/svc-cron/type delete mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-cron diff --git a/root/etc/s6-overlay/s6-rc.d/svc-cron/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-cron/dependencies.d/init-services deleted file mode 100644 index e69de29..0000000 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-cron/run b/root/etc/s6-overlay/s6-rc.d/svc-cron/run deleted file mode 100755 index ccc3374..0000000 --- a/root/etc/s6-overlay/s6-rc.d/svc-cron/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/with-contenv bash -# shellcheck shell=bash - -exec busybox crond -f -S -l 5 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-cron/type b/root/etc/s6-overlay/s6-rc.d/svc-cron/type deleted file mode 100644 index 5883cff..0000000 --- a/root/etc/s6-overlay/s6-rc.d/svc-cron/type +++ /dev/null @@ -1 +0,0 @@ -longrun diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-cron b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-cron deleted file mode 100644 index e69de29..0000000 From 83e9d91a63deda5ac572c8c3ea3f56881b7e3e73 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Fri, 18 Aug 2023 23:37:13 -0500 Subject: [PATCH 4/5] cron in base Signed-off-by: Eric Nemchik --- .../dependencies.d/init-crontab-config | 0 .../dependencies.d/init-feed2toot-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-feed2toot-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 e69de29..0000000 diff --git a/root/etc/s6-overlay/s6-rc.d/init-crontab-config/dependencies.d/init-feed2toot-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-feed2toot-config similarity index 100% rename from root/etc/s6-overlay/s6-rc.d/init-crontab-config/dependencies.d/init-feed2toot-config rename to root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-feed2toot-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 c49a50c..0000000 --- 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 bdd22a1..0000000 --- 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 d354111..0000000 --- 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 e69de29..0000000 From b9e65e6f70209a6ed61b70a2ed9b2ce3533e4a4f Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sat, 19 Aug 2023 10:16:38 -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