Commit 9e56a587 authored by Fabio Montefuscolo's avatar Fabio Montefuscolo
Browse files

scripts can't have dots on it's names

parent 84db7d9a
Pipeline #2969 passed with stage
in 51 seconds
......@@ -12,5 +12,5 @@ VOLUME ["/etc/periodic", "/root/.aws"]
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD [ "crond", "-d", "-l5" ]
CMD ["crond", "-d", "-l", "5", "-L", "/var/log/crond.log"]
......@@ -16,47 +16,31 @@ then
fi
[ -n "$SCRIPT_15MIN" ] \
&& echo -e "#/bin/sh\n$SCRIPT_15MIN" \
> /etc/periodic/15min/oneline_script.sh
&& echo -e "#!/bin/sh\n$SCRIPT_15MIN" \
> /etc/periodic/15min/oneline_script
[ -n "$SCRIPT_HOURLY" ] \
&& echo -e "#/bin/sh\n$SCRIPT_HOURLY" \
> /etc/periodic/hourly/oneline_script.sh
&& echo -e "#!/bin/sh\n$SCRIPT_HOURLY" \
> /etc/periodic/hourly/oneline_script
[ -n "$SCRIPT_DAILY" ] \
&& echo -e "#/bin/sh\n$SCRIPT_DAILY" \
> /etc/periodic/daily/oneline_script.sh
&& echo -e "#!/bin/sh\n$SCRIPT_DAILY" \
> /etc/periodic/daily/oneline_script
[ -n "$SCRIPT_WEEKLY" ] \
&& echo -e "#/bin/sh\n$SCRIPT_WEEKLY" \
> /etc/periodic/weekly/oneline_script.sh
&& echo -e "#!/bin/sh\n$SCRIPT_WEEKLY" \
> /etc/periodic/weekly/oneline_script
[ -n "$SCRIPT_MONTHLY" ] \
&& echo -e "#/bin/sh\n$SCRIPT_MONTHLY" \
> /etc/periodic/monthly/oneline_script.sh
&& echo -e "#!/bin/sh\n$SCRIPT_MONTHLY" \
> /etc/periodic/monthly/oneline_script
find /etc/periodic \
-mindepth 2 \
-maxdepth 2 \
-type f -name "*.sh" \
find /etc/periodic \
-mindepth 2 \
-maxdepth 2 \
-type f -name "oneline_script" \
-exec chmod 755 {} \;
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
echo "$@"
"$@"
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