File tree Expand file tree Collapse file tree 8 files changed +44
-0
lines changed
root/etc/s6-overlay/s6-rc.d Expand file tree Collapse file tree 8 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/with-contenv bash
2+ # shellcheck shell=bash
3+
4+ for cron_user in abc root; do
5+ if [[ -f "/defaults/crontabs/${cron_user}" ]]; then
6+ # make folders
7+ mkdir -p \
8+ /config/crontabs
9+
10+ # if crontabs do not exist in config
11+ if [[ ! -f "/config/crontabs/${cron_user}" ]]; then
12+ # copy crontab from system
13+ if crontab -l -u "${cron_user}" >/dev/null; then
14+ crontab -l -u "${cron_user}" >"/config/crontabs/${cron_user}"
15+ fi
16+
17+ # if crontabs still do not exist in config (were not copied from system)
18+ # copy crontab from image defaults (using -n, do not overwrite an existing file)
19+ cp -n "/defaults/crontabs/${cron_user}" /config/crontabs/
20+ fi
21+
22+ # set permissions and import user crontabs
23+ lsiown "${cron_user}":"${cron_user}" "/config/crontabs/${cron_user}"
24+ crontab -u "${cron_user}" "/config/crontabs/${cron_user}"
25+ fi
26+ done
Original file line number Diff line number Diff line change 1+ oneshot
Original file line number Diff line number Diff line change 1+ /etc/s6-overlay/s6-rc.d/init-crontab-config/run
Original file line number Diff line number Diff line change 1+ #!/usr/bin/with-contenv bash
2+ # shellcheck shell=bash
3+
4+ if builtin command -v crontab >/dev/null && [[ -n "$(crontab -l -u abc)" || -n "$(crontab -l -u root)" ]]; then
5+ if builtin command -v busybox >/dev/null && [[ $(busybox) =~ [[:space:]](crond)([,]|$) ]]; then
6+ exec busybox crond -f -S -l 5
7+ elif [[ -f /usr/bin/apt ]] && [[ -f /usr/sbin/cron ]]; then
8+ exec /usr/sbin/cron -f -L 5
9+ else
10+ echo "**** cron not found ****"
11+ sleep infinity
12+ fi
13+ else
14+ sleep infinity
15+ fi
Original file line number Diff line number Diff line change 1+ longrun
You can’t perform that action at this time.
0 commit comments