Skip to content

Commit

Permalink
Merge pull request #30 from docker/3.3instrumenting
Browse files Browse the repository at this point in the history
set cron job to run at random time between midnight and 4am
  • Loading branch information
pcaskey authored Feb 15, 2017
2 parents 243b1fb + fdb1248 commit 97de1bd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion files/bin/startup.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions files/tier-crontab

This file was deleted.

0 comments on commit 97de1bd

Please sign in to comment.