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
3 changes: 2 additions & 1 deletion root/etc/cont-init.d/95-apt-get
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

if [ -f /usr/bin/apt ]; then
apt-get update
fi
fi
53 changes: 29 additions & 24 deletions root/etc/cont-init.d/95-cron
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

# determine if setup is needed for ubuntu
if [ ! -f /usr/sbin/cron ] && \
[ -f /usr/bin/apt ]; then
if [ ! -f /usr/sbin/cron ] &&
[ -f /usr/bin/apt ]; then
# install cron
apt-get install --no-install-recommends -y \
cron
Expand All @@ -12,30 +13,34 @@ fi
mkdir -p \
/config/crontabs

# if root crontabs do not exist in config
# copy root crontab from system
if [[ ! -f /config/crontabs/root ]] && \
crontab -l -u root; then
crontab -l -u root > /config/crontabs/root
fi

# if root crontabs still do not exist in config (were not copied from system)
# copy root crontab from included defaults
[[ ! -f /config/crontabs/root ]] && \
cp /defaults/crontabs-mod/root /config/crontabs/
## root
# if crontabs do not exist in config
if [[ ! -f /config/crontabs/root ]]; then
# copy crontab from system
if crontab -l -u root; then
crontab -l -u root >/config/crontabs/root
fi

# if abc crontabs do not exist in config
# copy abc crontab from system
if [[ ! -f /config/crontabs/abc ]] && \
crontab -l -u abc; then
crontab -l -u abc > /config/crontabs/abc
# 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-mod/root /config/crontabs/
fi
# set permissions and import user crontabs
lsiown root:root /config/crontabs/root
crontab -u root /config/crontabs/root

# if abc crontabs still do not exist in config (were not copied from system)
# copy abc crontab from included defaults
[[ ! -f /config/crontabs/abc ]] && \
cp /defaults/crontabs-mod/abc /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

# import user crontabs
crontab -u root /config/crontabs/root
# 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-mod/abc /config/crontabs/
fi
# set permissions and import user crontabs
lsiown abc:abc /config/crontabs/abc
crontab -u abc /config/crontabs/abc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

if [ ! -f /usr/sbin/cron ] && [ -f /usr/bin/apt ]; then
echo "**** Adding cron to package install list ****"
echo "cron" >> /mod-repo-packages-to-install.list
echo "cron" >>/mod-repo-packages-to-install.list
else
echo "**** cron package already installed, skipping ****"
fi
35 changes: 19 additions & 16 deletions root/etc/s6-overlay/s6-rc.d/init-mod-universal-cron-setup/run
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

# make folders
mkdir -p \
/config/crontabs

# if root crontabs do not exist in config
## root
# if crontabs do not exist in config
if [[ ! -f /config/crontabs/root ]]; then
# copy root crontab from system
# copy crontab from system
if crontab -l -u root; then
crontab -l -u root > /config/crontabs/root
crontab -l -u root >/config/crontabs/root
fi
# if root crontabs still do not exist in config (were not copied from system)
# copy root crontab from included defaults (using -n, do not overwrite an existing file)

# 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-mod/root /config/crontabs/
fi
# set permissions and import user crontabs
lsiown root:root /config/crontabs/root
crontab -u root /config/crontabs/root


# if abc crontabs do not exist in config
## abc
# if crontabs do not exist in config
if [[ ! -f /config/crontabs/abc ]]; then
# copy abc crontab from system
# copy crontab from system
if crontab -l -u abc; then
crontab -l -u abc > /config/crontabs/abc
crontab -l -u abc >/config/crontabs/abc
fi

# if abc crontabs still do not exist in config (were not copied from system)
# copy abc crontab from included defaults
# 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-mod/abc /config/crontabs/
fi


# import user crontabs
crontab -u root /config/crontabs/root
# set permissions and import user crontabs
lsiown abc:abc /config/crontabs/abc
crontab -u abc /config/crontabs/abc
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-mod-universal-cron/run
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

if [ -f /usr/bin/apt ]; then
# ubuntu
Expand Down
4 changes: 2 additions & 2 deletions root/etc/services.d/cron/run
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

if [ -f /usr/bin/apt ]; then
# ubuntu
exec /usr/sbin/cron -f -L 1
fi
if [ -f /sbin/apk ]; then
elif [ -f /sbin/apk ]; then
# alpine
exec /usr/sbin/crond -f -S -l 5
fi