rodzic
6b17ac8522
commit
538b1b7d77
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
oneshot
|
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/init-crontab-config/run
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
longrun
|
Ładowanie…
Reference in New Issue