Browse Source

new: [vps] make ``vps backup`` compatible with new ``cron`` containers

pull/6/head
Valentin Lab 10 months ago
parent
commit
1f42339d22
  1. 22
      bin/vps

22
bin/vps

@ -916,9 +916,25 @@ compose:get_cron_docker_cmd() {
local cron_line cmd_line docker_cmd
project_name=$(compose:project_name) || return 1
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."
echo " Have you forgotten to run 'compose up' ?" >&2
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
err "Can't find cron_line in cron container."
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
fi

Loading…
Cancel
Save