Allow running as binary without cron

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
pull/244/head
Chirag Aggarwal 2023-06-29 17:02:51 +00:00 zatwierdzone przez Dan Helfman
rodzic e7f1635626
commit b0964aba6d
2 zmienionych plików z 18 dodań i 9 usunięć

Wyświetl plik

@ -38,4 +38,4 @@ COPY --link requirements.txt /
RUN python3 -m pip install --no-cache -Ur requirements.txt
RUN borgmatic --bash-completion > /usr/share/bash-completion/completions/borgmatic && echo "source /etc/profile.d/bash_completion.sh" > /root/.bashrc
CMD ["/entry.sh"]
ENTRYPOINT ["/entry.sh"]

Wyświetl plik

@ -10,14 +10,23 @@ echo borgmatic $borgmaticver
echo $borgver
echo apprise $apprisever
# Test crontab
supercronic -test /etc/borgmatic.d/crontab.txt || exit 1
if [ $# -eq 0 ]; then
# Test crontab
supercronic -test /etc/borgmatic.d/crontab.txt || exit 1
# Start supercronic
if [ -n "${SUPERCRONIC_EXTRA_FLAGS}" ]; then
echo "The variable SUPERCRONIC_EXTRA_FLAGS is not empty, using extra flags"
supercronic $SUPERCRONIC_EXTRA_FLAGS /etc/borgmatic.d/crontab.txt
# Start supercronic
if [ -n "${SUPERCRONIC_EXTRA_FLAGS}" ]; then
echo "The variable SUPERCRONIC_EXTRA_FLAGS is not empty, using extra flags"
supercronic $SUPERCRONIC_EXTRA_FLAGS /etc/borgmatic.d/crontab.txt
else
echo "The variable SUPERCRONIC_EXTRA_FLAGS is empty, starting normally"
supercronic /etc/borgmatic.d/crontab.txt
fi
else
echo "The variable SUPERCRONIC_EXTRA_FLAGS is empty, starting normally"
supercronic /etc/borgmatic.d/crontab.txt
if [ "$1" = "bash" ] || [ "$1" = "sh" ] || [ "$1" = "/bin/bash" ] || [ "$1" = "/bin/sh" ]; then
exec "$@"
else
borgmatic "$@"
fi
fi