mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-19 01:46:10 -04:00
Merge pull request #595 from linuxserver/universal-cron-formatting
Format shell scripts and set permissions
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
if [ -f /usr/bin/apt ]; then
|
if [ -f /usr/bin/apt ]; then
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
# determine if setup is needed for ubuntu
|
# determine if setup is needed for ubuntu
|
||||||
if [ ! -f /usr/sbin/cron ] && \
|
if [ ! -f /usr/sbin/cron ] &&
|
||||||
[ -f /usr/bin/apt ]; then
|
[ -f /usr/bin/apt ]; then
|
||||||
# install cron
|
# install cron
|
||||||
apt-get install --no-install-recommends -y \
|
apt-get install --no-install-recommends -y \
|
||||||
cron
|
cron
|
||||||
@@ -12,30 +13,34 @@ fi
|
|||||||
mkdir -p \
|
mkdir -p \
|
||||||
/config/crontabs
|
/config/crontabs
|
||||||
|
|
||||||
# if root crontabs do not exist in config
|
## root
|
||||||
# copy root crontab from system
|
# if crontabs do not exist in config
|
||||||
if [[ ! -f /config/crontabs/root ]] && \
|
if [[ ! -f /config/crontabs/root ]]; then
|
||||||
crontab -l -u root; then
|
# copy crontab from system
|
||||||
crontab -l -u root > /config/crontabs/root
|
if crontab -l -u root; then
|
||||||
|
crontab -l -u root >/config/crontabs/root
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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
|
fi
|
||||||
|
# set permissions and import user crontabs
|
||||||
# if root crontabs still do not exist in config (were not copied from system)
|
lsiown root:root /config/crontabs/root
|
||||||
# copy root crontab from included defaults
|
|
||||||
[[ ! -f /config/crontabs/root ]] && \
|
|
||||||
cp /defaults/crontabs-mod/root /config/crontabs/
|
|
||||||
|
|
||||||
# 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
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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/
|
|
||||||
|
|
||||||
# import user crontabs
|
|
||||||
crontab -u root /config/crontabs/root
|
crontab -u root /config/crontabs/root
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
|
# 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
|
crontab -u abc /config/crontabs/abc
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
if [ ! -f /usr/sbin/cron ] && [ -f /usr/bin/apt ]; then
|
if [ ! -f /usr/sbin/cron ] && [ -f /usr/bin/apt ]; then
|
||||||
echo "**** Adding cron to package install list ****"
|
echo "**** Adding cron to package install list ****"
|
||||||
echo "cron" >> /mod-repo-packages-to-install.list
|
echo "cron" >>/mod-repo-packages-to-install.list
|
||||||
else
|
else
|
||||||
echo "**** cron package already installed, skipping ****"
|
echo "**** cron package already installed, skipping ****"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,35 +1,38 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
# make folders
|
# make folders
|
||||||
mkdir -p \
|
mkdir -p \
|
||||||
/config/crontabs
|
/config/crontabs
|
||||||
|
|
||||||
# if root crontabs do not exist in config
|
## root
|
||||||
|
# if crontabs do not exist in config
|
||||||
if [[ ! -f /config/crontabs/root ]]; then
|
if [[ ! -f /config/crontabs/root ]]; then
|
||||||
# copy root crontab from system
|
# copy crontab from system
|
||||||
if crontab -l -u root; then
|
if crontab -l -u root; then
|
||||||
crontab -l -u root > /config/crontabs/root
|
crontab -l -u root >/config/crontabs/root
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if root crontabs still do not exist in config (were not copied from system)
|
# if 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)
|
# copy crontab from included defaults (using -n, do not overwrite an existing file)
|
||||||
cp -n /defaults/crontabs-mod/root /config/crontabs/
|
cp -n /defaults/crontabs-mod/root /config/crontabs/
|
||||||
fi
|
fi
|
||||||
|
# set permissions and import user crontabs
|
||||||
|
lsiown root:root /config/crontabs/root
|
||||||
|
crontab -u root /config/crontabs/root
|
||||||
|
|
||||||
|
## abc
|
||||||
# if abc crontabs do not exist in config
|
# if crontabs do not exist in config
|
||||||
if [[ ! -f /config/crontabs/abc ]]; then
|
if [[ ! -f /config/crontabs/abc ]]; then
|
||||||
# copy abc crontab from system
|
# copy crontab from system
|
||||||
if crontab -l -u abc; then
|
if crontab -l -u abc; then
|
||||||
crontab -l -u abc > /config/crontabs/abc
|
crontab -l -u abc >/config/crontabs/abc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if abc crontabs still do not exist in config (were not copied from system)
|
# if crontabs still do not exist in config (were not copied from system)
|
||||||
# copy abc crontab from included defaults
|
# copy crontab from included defaults (using -n, do not overwrite an existing file)
|
||||||
cp -n /defaults/crontabs-mod/abc /config/crontabs/
|
cp -n /defaults/crontabs-mod/abc /config/crontabs/
|
||||||
fi
|
fi
|
||||||
|
# set permissions and import user crontabs
|
||||||
|
lsiown abc:abc /config/crontabs/abc
|
||||||
# import user crontabs
|
|
||||||
crontab -u root /config/crontabs/root
|
|
||||||
crontab -u abc /config/crontabs/abc
|
crontab -u abc /config/crontabs/abc
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
if [ -f /usr/bin/apt ]; then
|
if [ -f /usr/bin/apt ]; then
|
||||||
# ubuntu
|
# ubuntu
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
if [ -f /usr/bin/apt ]; then
|
if [ -f /usr/bin/apt ]; then
|
||||||
# ubuntu
|
# ubuntu
|
||||||
exec /usr/sbin/cron -f -L 1
|
exec /usr/sbin/cron -f -L 1
|
||||||
fi
|
elif [ -f /sbin/apk ]; then
|
||||||
if [ -f /sbin/apk ]; then
|
|
||||||
# alpine
|
# alpine
|
||||||
exec /usr/sbin/crond -f -S -l 5
|
exec /usr/sbin/crond -f -S -l 5
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user