From feaedf5b72a23f4c35313cb1354f08d00eaed79b Mon Sep 17 00:00:00 2001 From: Paul Caskey Date: Tue, 14 Feb 2017 16:22:17 -0600 Subject: [PATCH] fixes for starting crond in containers --- Dockerfile | 8 +++++--- files/bin/sendtierbeacon.sh | 3 +++ files/bin/setenv.sh | 4 ++++ files/bin/startcron.sh | 3 --- files/bin/startup.sh | 5 +++++ 5 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 files/bin/setenv.sh delete mode 100644 files/bin/startcron.sh create mode 100644 files/bin/startup.sh diff --git a/Dockerfile b/Dockerfile index 49894d3..c9c8c4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -94,10 +94,13 @@ RUN set -x \ ADD files/idp.xml conf/Catalina/idp.xml ADD files/server.xml conf/server.xml +ADD files/bin/setenv.sh /opt/tier/setenv.sh +RUN chmod +x /opt/tier/setenv.sh ADD files/tier-crontab /opt/tier/tier-crontab RUN crontab /opt/tier/tier-crontab -ADD files/bin/startcron.sh /usr/bin/startcron.sh -RUN chmod +x /usr/bin/startcron.sh +ADD files/tier-crontab /etc/cron.d/tier-crontab +ADD files/bin/startup.sh /usr/bin/startup.sh +RUN chmod +x /usr/bin/startup.sh ADD files/bin/sendtierbeacon.sh /usr/bin/sendtierbeacon.sh RUN chmod +x /usr/bin/sendtierbeacon.sh RUN touch /var/log/cron.log @@ -106,4 +109,3 @@ ENV PATH $CATALINA_HOME/bin:$JAVA_HOME/bin:$PATH ONBUILD COPY ./root/ /opt/shibboleth/$SHIB_PREFIX/ -CMD /usr/bin/startcron.sh diff --git a/files/bin/sendtierbeacon.sh b/files/bin/sendtierbeacon.sh index 7c6b8da..1d09a9a 100644 --- a/files/bin/sendtierbeacon.sh +++ b/files/bin/sendtierbeacon.sh @@ -1,6 +1,9 @@ #!/bin/sh LOGHOST="cerif.org" LOGPORT="5000" +if [ -s /opt/tier/env.bash ]; then + . /opt/tier/env.bash +fi LOGTEXT="TIERBEACON/TIER/1.0#IM=$IMAGENAME#IV=$VERSION-$TIERVERSION#MT=$MAINTAINER#" if [ -z "$TIER_BEACON_OPT_OUT" ]; then `logger -n $LOGHOST -P $LOGPORT -t TIERBEACON $LOGTEXT` diff --git a/files/bin/setenv.sh b/files/bin/setenv.sh new file mode 100644 index 0000000..8e53f7c --- /dev/null +++ b/files/bin/setenv.sh @@ -0,0 +1,4 @@ +printenv | sed 's/^\(.*\)$/\1/g' | grep -E "^VERSION" > /opt/tier/env.bash +printenv | sed 's/^\(.*\)$/\1/g' | grep -E "^TIERVERSION" >> /opt/tier/env.bash +printenv | sed 's/^\(.*\)$/\1/g' | grep -E "^IMAGE" >> /opt/tier/env.bash +printenv | sed 's/^\(.*\)$/\1/g' | grep -E "^MAINTAINER" >> /opt/tier/env.bash \ No newline at end of file diff --git a/files/bin/startcron.sh b/files/bin/startcron.sh deleted file mode 100644 index 701f211..0000000 --- a/files/bin/startcron.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -/usr/sbin/crond -touch /var/log/cron.log diff --git a/files/bin/startup.sh b/files/bin/startup.sh new file mode 100644 index 0000000..977adf3 --- /dev/null +++ b/files/bin/startup.sh @@ -0,0 +1,5 @@ +#!/bin/sh +/opt/tier/setenv.sh +touch /var/log/cron.log +/usr/sbin/crond +/usr/local/tomcat/bin/catalina.sh run