mirror of
https://github.com/linuxserver/docker-mods.git
synced 2026-03-23 00:05:28 +08:00
Merge pull request #475 from linuxserver/universal-cron-s6v3
switch to hybrid (universal-cron)
This commit is contained in:
commit
a614cef135
8
root/etc/s6-overlay/s6-rc.d/init-mod-universal-cron-add-package/run
Executable file
8
root/etc/s6-overlay/s6-rc.d/init-mod-universal-cron-add-package/run
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/with-contenv 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
|
||||
else
|
||||
echo "**** cron package already installed, skipping ****"
|
||||
fi
|
||||
@ -0,0 +1 @@
|
||||
oneshot
|
||||
@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-mod-universal-cron-add-package/run
|
||||
35
root/etc/s6-overlay/s6-rc.d/init-mod-universal-cron-setup/run
Executable file
35
root/etc/s6-overlay/s6-rc.d/init-mod-universal-cron-setup/run
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# make folders
|
||||
mkdir -p \
|
||||
/config/crontabs
|
||||
|
||||
# if root crontabs do not exist in config
|
||||
if [[ ! -f /config/crontabs/root ]]; then
|
||||
# copy root crontab from system
|
||||
if 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 (using -n, do not overwrite an existing file)
|
||||
cp -n /defaults/crontabs-mod/root /config/crontabs/
|
||||
fi
|
||||
|
||||
|
||||
# if abc crontabs do not exist in config
|
||||
if [[ ! -f /config/crontabs/abc ]]; then
|
||||
# copy abc crontab from system
|
||||
if crontab -l -u abc; then
|
||||
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
|
||||
cp -n /defaults/crontabs-mod/abc /config/crontabs/
|
||||
fi
|
||||
|
||||
|
||||
# import user crontabs
|
||||
crontab -u root /config/crontabs/root
|
||||
crontab -u abc /config/crontabs/abc
|
||||
@ -0,0 +1 @@
|
||||
oneshot
|
||||
@ -0,0 +1 @@
|
||||
/etc/s6-overlay/s6-rc.d/init-mod-universal-cron-setup/run
|
||||
9
root/etc/s6-overlay/s6-rc.d/svc-mod-universal-cron/run
Executable file
9
root/etc/s6-overlay/s6-rc.d/svc-mod-universal-cron/run
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
if [ -f /usr/bin/apt ]; then
|
||||
# ubuntu
|
||||
exec /usr/sbin/cron -f -L 1
|
||||
elif [ -f /sbin/apk ]; then
|
||||
# alpine
|
||||
exec /usr/sbin/crond -f -S -l 5
|
||||
fi
|
||||
1
root/etc/s6-overlay/s6-rc.d/svc-mod-universal-cron/type
Normal file
1
root/etc/s6-overlay/s6-rc.d/svc-mod-universal-cron/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
||||
0
root/etc/services.d/cron/run
Normal file → Executable file
0
root/etc/services.d/cron/run
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user