Skip to content

Commit

Permalink
Add own crond service
Browse files Browse the repository at this point in the history
  • Loading branch information
xZero707 committed May 16, 2024
1 parent 943fb38 commit 0d8eaa9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ FROM scratch AS rootfs
# Install attr utility
COPY --from=nlss/attr ["/usr/local/bin/attr", "/usr/local/bin/"]

# Add crond service
COPY --from=ghcr.io/n0rthernl1ghts/base-alpine:3.17 ["/etc/services.d/cron/", "/etc/services.d/cron/"]

# WordPress specific php configuration
COPY --from=wordpress ["/usr/local/etc/php/conf.d/opcache-recommended.ini", "/usr/local/etc/php/conf.d/error-logging.ini", "/usr/local/etc/php/conf.d/"]

Expand Down
18 changes: 18 additions & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/crond/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/command/with-contenv bash
# shellcheck shell=bash

# crond main
main() {
# This will prepend service name to all output from here
exec > >(while read line; do echo "[crond] ${line}"; done) 2>&1

if [[ "${CRON_ENABLED}" == "false" || "${CRON_ENABLED}" == "0" ]]
then
echo "CRON_ENABLED is set to false. Service disabled"
sleep infinity
fi

echo "Starting cron daemon"
/usr/sbin/crond -f -l 2
}
main
1 change: 1 addition & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/crond/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
1 change: 1 addition & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/crond/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/crond/run
Empty file.

0 comments on commit 0d8eaa9

Please sign in to comment.