Browse Source

chg: [cron] remove ``logrotate`` concerns.

These bits of code were reminiscent of a time where ``logrotate``
charm would be subordinate of ``cron`` charm.
framadate
Valentin Lab 6 years ago
parent
commit
739db0dc35
  1. 7
      cron/build/Dockerfile
  2. 38
      cron/build/src/usr/bin/docker-send-signal

7
cron/build/Dockerfile

@ -5,14 +5,7 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
## XXXvlab: these should be added by logrotate only
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes netcat-openbsd logrotate && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY ./src/usr/bin/lock /usr/bin/lock
COPY ./src/usr/bin/docker-send-signal /usr/bin/docker-send-signal
COPY ./src/usr/bin/docker-17.06.2-ce /usr/bin/docker
COPY ./entrypoint.sh /entrypoint.sh

38
cron/build/src/usr/bin/docker-send-signal

@ -1,38 +0,0 @@
#!/bin/bash
exname=$(basename "$0")
usage="$exname [-h|--help] CONTAINER SIGNAL"
container=
signal=
while [ "$1" ]; do
case "$1" in
"--help"|"-h")
echo "$usage" >&2
exit 0
;;
*)
[ -z "$container" ] && { container=$1 ; shift ; continue ; }
[ -z "$signal" ] && { signal=$1 ; shift ; continue ; }
echo "Unexpected argument '$1'." >&2
exit 1
;;
esac
shift
done
if [ -z "$container" ]; then
echo "You must provide a container name/id as first argument." >&2
echo "$usage" >&2
exit 1
fi
if [ -z "$signal" ]; then
echo "You must provide a signal to send to $container aargument." >&2
echo "$usage" >&2
exit 1
fi
container_id="$(docker inspect --format="{{ .Id }}" "$container")"
echo -e "POST /containers/$container_id/kill?signal=$signal HTTP/1.0\r\n" | nc -U /var/run/docker.sock
Loading…
Cancel
Save