You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

30 lines
648 B

#!/bin/bash
##
## Quick and dirty check launching backup
##
if ! cron_line=$(docker exec -ti myc_cron_1 cat /etc/cron.d/rsync-backup | grep "\* \* \*"); then
echo "can't find cron_line in cron container." >&2
exit 1
fi
cron_line=${cron_line%|*}
cron_line=${cron_line%"2>&1"*}
cmd_line="${cron_line#*root}"
eval "args=($cmd_line)"
## should be last argument
docker_cmd=$(echo ${args[@]: -1})
if ! [[ "$docker_cmd" == "docker run --rm -e "* ]]; then
echo "docker command found should start with 'docker run'." >&2
echo "Here's command:" >&2
echo " $docker_cmd" >&2
exit 1
fi
eval "docker exec -i myc_cron_1 $docker_cmd"