Commit 274f9602 authored by Fabio Montefuscolo's avatar Fabio Montefuscolo
Browse files

initial commit

parents
FROM alpine:latest
MAINTAINER Fabio Montefuscolo <fabio.montefuscolo@gmail.com>
RUN apk update && \
apk add dcron && \
rm -rf /var/cache/apk/*
VOLUME [ \
"/etc/periodic/15min", \
"/etc/periodic/hourly", \
"/etc/periodic/daily", \
"/etc/periodic/weekly", \
"/etc/periodic/monthly" \
]
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD [ "crond", "-d", "-l5" ]
#!/bin/sh
DAEMON=crond
stop() {
echo "Received SIGINT or SIGTERM. Shutting down $DAEMON"
pid=$(cat /var/run/$DAEMON/$DAEMON.pid)
kill -SIGTERM "${pid}"
wait "${pid}"
echo "Done."
}
echo "Running $@"
if [ "$(basename $1)" == "$DAEMON" ]; then
trap stop SIGINT SIGTERM
$@ &
pid="$!"
mkdir -p /var/run/$DAEMON && echo "${pid}" > /var/run/$DAEMON/$DAEMON.pid
wait "${pid}" && exit $?
else
exec "$@"
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment