Browse Source

new: [myc-check-and-launch-backup] new script for checking backup installation

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
rc1
Valentin Lab 4 years ago
parent
commit
737ffe31fc
  1. 30
      bin/myc-check-and-launch-backup

30
bin/myc-check-and-launch-backup

@ -0,0 +1,30 @@
#!/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"
Loading…
Cancel
Save