diff --git a/container_files/bin/setupcron.sh b/container_files/bin/setupcron.sh new file mode 100644 index 0000000..ee1ec96 --- /dev/null +++ b/container_files/bin/setupcron.sh @@ -0,0 +1,18 @@ +#!/bin/bash +CRONFILE=/opt/tier/tier-cron + +#set env vars for cron job +# this script creates /opt/tier/env.bash which is sourced by the cron job's script, which was not seeing the environment set by the Dockerfile +/opt/tier/setenv.sh + +#build crontab file with random start time between midnight and 3:59am +echo "#send daily beacon to TIER Central" > ${CRONFILE} +echo $(expr $RANDOM % 59) $(expr $RANDOM % 3) "* * * /usr/bin/sendtierbeacon.sh >> /var/log/cron.log 2>&1" >> ${CRONFILE} +chmod 644 ${CRONFILE} + +#install crontab +crontab ${CRONFILE} + +#create cron logfile +touch /var/log/cron.log + diff --git a/container_files/bin/startup.sh b/container_files/bin/startup.sh index ff771bf..9916e74 100644 --- a/container_files/bin/startup.sh +++ b/container_files/bin/startup.sh @@ -16,7 +16,10 @@ crontab ${CRONFILE} touch /var/log/cron.log #start crond -/usr/sbin/crond +/usr/sbin/crond -n +#if crond args are needed, then: +#source /etc/sysconfig/crond && exec /usr/sbin/crond -n $CRONDARGS + #start tomcat -/usr/local/tomcat/bin/catalina.sh run +#/usr/local/tomcat/bin/catalina.sh run diff --git a/container_files/system/supervisord.conf b/container_files/system/supervisord.conf new file mode 100644 index 0000000..6af4ba5 --- /dev/null +++ b/container_files/system/supervisord.conf @@ -0,0 +1,23 @@ +[supervisord] +nodaemon=true + +[program:cron] +command=/usr/sbin/crond -n +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +directory=/usr/bin + +[program:tomcat] +command=/usr/local/tomcat/bin/catalina.sh run +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0