diff --git a/Dockerfile b/Dockerfile index c9c8c4f..028d63d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -96,9 +96,6 @@ 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/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 diff --git a/files/bin/startup.sh b/files/bin/startup.sh index 977adf3..37a317c 100644 --- a/files/bin/startup.sh +++ b/files/bin/startup.sh @@ -1,5 +1,21 @@ -#!/bin/sh +#!/bin/bash +#set env vars for cron job /opt/tier/setenv.sh + +#build crontab file with random start time between midnight and 3:59am +echo "#send daily beacon to TIER Central" > /opt/tier/tier-cron +echo "* * * * * /usr/bin/sendtierbeacon.sh >> /var/log/cron.log 2>&1" >> /opt/tier/tier-cron +echo "#"$(expr $RANDOM % 59) $(expr $RANDOM % 3) "* * * /usr/bin/sendtierbeacon.sh >> /var/log/cron.log 2>&1" >> /opt/tier/tier-cron +chmod 644 /opt/tier/tier-cron + +#install crontab +crontab /opt/tier/tier-crontab + +#create cron logfile touch /var/log/cron.log + +#start crond /usr/sbin/crond + +#start tomcat /usr/local/tomcat/bin/catalina.sh run diff --git a/files/tier-crontab b/files/tier-crontab deleted file mode 100644 index 590dd74..0000000 --- a/files/tier-crontab +++ /dev/null @@ -1,2 +0,0 @@ -#send daily ping to TIER Central -0 0 * * * /usr/bin/sendtierbeacon.sh >> /var/log/cron.log 2>&1