Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \
RUN \
echo "**** install base packages ****" && \
dnf -y --setopt=install_weak_deps=False --best install \
busybox \
ca-certificates \
coreutils \
curl \
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \
RUN \
echo "**** install base packages ****" && \
dnf -y --setopt=install_weak_deps=False --best install \
busybox \
ca-certificates \
coreutils \
curl \
Expand Down
26 changes: 26 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/init-crontab-config/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

for cron_user in abc root; do
if [[ -f "/defaults/crontabs/${cron_user}" ]]; then
# make folders
mkdir -p \
/config/crontabs

# if crontabs do not exist in config
if [[ ! -f "/config/crontabs/${cron_user}" ]]; then
# copy crontab from system
if crontab -l -u "${cron_user}" >/dev/null; then
crontab -l -u "${cron_user}" >"/config/crontabs/${cron_user}"
fi

# if crontabs still do not exist in config (were not copied from system)
# copy crontab from image defaults (using -n, do not overwrite an existing file)
cp -n "/defaults/crontabs/${cron_user}" /config/crontabs/
fi

# set permissions and import user crontabs
lsiown "${cron_user}":"${cron_user}" "/config/crontabs/${cron_user}"
crontab -u "${cron_user}" "/config/crontabs/${cron_user}"
fi
done
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/init-crontab-config/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/init-crontab-config/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-crontab-config/run
Empty file.
15 changes: 15 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-cron/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

if builtin command -v crontab >/dev/null && [[ -n "$(crontab -l -u abc)" || -n "$(crontab -l -u root)" ]]; then
if builtin command -v busybox >/dev/null && [[ $(busybox) =~ [[:space:]](crond)([,]|$) ]]; then
exec busybox crond -f -S -l 5
elif [[ -f /usr/bin/apt ]] && [[ -f /usr/sbin/cron ]]; then
exec /usr/sbin/cron -f -L 5
else
echo "**** cron not found ****"
sleep infinity
fi
else
sleep infinity
fi
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-cron/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.