|
@ -916,9 +916,25 @@ compose:get_cron_docker_cmd() { |
|
|
local cron_line cmd_line docker_cmd |
|
|
local cron_line cmd_line docker_cmd |
|
|
project_name=$(compose:project_name) || return 1 |
|
|
project_name=$(compose:project_name) || return 1 |
|
|
|
|
|
|
|
|
|
|
|
container=$(compose:service:containers "${project_name}" "cron") || { |
|
|
|
|
|
err "Can't find service 'cron' in project ${project_name}." |
|
|
|
|
|
return 1 |
|
|
|
|
|
} |
|
|
|
|
|
if docker exec "$container" test -e /etc/cron.d/rsync-backup; then |
|
|
if ! cron_line=$(docker exec "${project_name}"_cron_1 cat /etc/cron.d/rsync-backup | grep "\* \* \*"); then |
|
|
if ! cron_line=$(docker exec "${project_name}"_cron_1 cat /etc/cron.d/rsync-backup | grep "\* \* \*"); then |
|
|
err "Can't find cron_line in cron container." |
|
|
err "Can't find cron_line in cron container." |
|
|
echo " Have you forgotten to run 'compose up' ?" >&2 |
|
|
|
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
elif docker exec "$container" test -e /etc/crontabs/root; then |
|
|
|
|
|
if ! cron_line=$(docker exec "$container" cat /etc/crontabs/root | grep " launch-rsync-backup " | grep "\* \* \*"); then |
|
|
|
|
|
err "Can't find cron_line in cron container." |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
else |
|
|
|
|
|
err "Unrecognized cron container:" |
|
|
|
|
|
echo " Can't find neither:" >&2 |
|
|
|
|
|
echo " - /etc/cron.d/rsync-backup for old-style cron services" >&2 |
|
|
|
|
|
echo " - nor /etc/crontabs/root for new-style cron services." >&2 |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|