From 7a9aa02485795279cce8396aa767afe234fd6a75 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Sep 2022 22:27:00 +0000 Subject: [PATCH] fix comanage_cron --- Workbench/comanage_cron/Dockerfile | 32 +++++++++++----- .../container_files/system/root-crontab | 3 +- .../system/setupcroncomanage.sh | 37 +++++++++++++++++++ 3 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 Workbench/comanage_cron/container_files/system/setupcroncomanage.sh diff --git a/Workbench/comanage_cron/Dockerfile b/Workbench/comanage_cron/Dockerfile index 6326b88..2d04e9f 100644 --- a/Workbench/comanage_cron/Dockerfile +++ b/Workbench/comanage_cron/Dockerfile @@ -1,4 +1,4 @@ -FROM i2incommon/comanage-registry:4.0.2-20220223 +FROM i2incommon/comanage-registry-cron:4.0.2-20220223 ENV COMANAGE_REGISTRY_ADMIN_FAMILY_NAME=Anderson ENV COMANAGE_REGISTRY_ADMIN_USERNAME=banderson @@ -22,8 +22,10 @@ ENV COMANAGE_REGISTRY_EMAIL_HOST=smtp.example.edu #ENV SHIBBOLETH_SP_SAMLDS_URL=thing #RUN apt-get update --allow-releaseinfo-change && apt-get update -RUN yum -y update -RUN yum -y install nc +#RUN yum -y update +#RUN yum -y install nc +#RUN apt-get install -y nc +RUN apt-get install -y sendmail ARG maintainer=my ARG imagename=comanage @@ -35,13 +37,25 @@ ENV COMANAGE_REGISTRY_VIRTUAL_HOST_FQDN=$CSPHOSTNAME LABEL Version=$version ENV VERSION=$version +#COPY container_files/system/runcomangejob.sh /usr/local/bin/ +#COPY container_files/system/root-crontab /usr/local/etc +#RUN chmod 755 /usr/local/bin/runcomangejob.sh && \ +# mkdir -p /srv/comanage-registry/app/tmp +##&& \ +## /usr/bin/crontab -u root /usr/local/etc/root-crontab +# +#ENV COMANAGE_REGISTRY_CRONTAB=/usr/local/etc/root-crontab + +# activate SQL provisioning plugin +RUN mkdir -p /srv/comanage-registry/local/Plugin/ +RUN ln -s /srv/comanage-registry/app/AvailablePlugin/SqlProvisioner /srv/comanage-registry/local/Plugin/ + + +COPY container_files/system/setupcroncomanage.sh /usr/local/bin/setupcroncomanage.sh COPY container_files/system/runcomangejob.sh /usr/local/bin/ -COPY container_files/system/root-crontab /usr/local/etc +COPY --chown=www-data:www-data container_files/system/root-crontab /usr/local/etc RUN chmod 755 /usr/local/bin/runcomangejob.sh && \ - mkdir -p /srv/comanage-registry/app/tmp -#&& \ -# /usr/bin/crontab -u root /usr/local/etc/root-crontab - + /usr/bin/crontab -u www-data /usr/local/etc/root-crontab + ENV COMANAGE_REGISTRY_CRONTAB=/usr/local/etc/root-crontab - diff --git a/Workbench/comanage_cron/container_files/system/root-crontab b/Workbench/comanage_cron/container_files/system/root-crontab index 6edb2f0..9bd9619 100644 --- a/Workbench/comanage_cron/container_files/system/root-crontab +++ b/Workbench/comanage_cron/container_files/system/root-crontab @@ -1,5 +1,6 @@ +SHELL=/bin/bash +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin * * * * * /usr/local/bin/runcomangejob.sh 1 * * * * * /usr/local/bin/runcomangejob.sh 2 -* * * * * /usr/local/bin/runcomangejob.sh 3 # Deprecated job to run expirations, syncorgsources, and groupvalidity tasks (until Registry v4.0.0) 0 * * * * /usr/local/bin/runcomangejob.sh diff --git a/Workbench/comanage_cron/container_files/system/setupcroncomanage.sh b/Workbench/comanage_cron/container_files/system/setupcroncomanage.sh new file mode 100644 index 0000000..17ed283 --- /dev/null +++ b/Workbench/comanage_cron/container_files/system/setupcroncomanage.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# COmanage Registry shell script to install TIER beacon crontab +# +# Portions licensed to the University Corporation for Advanced Internet +# Development, Inc. ("UCAID") under one or more contributor license agreements. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# UCAID licenses this file to you under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +CRONFILE='/tmp/cronfile' + +# Set up job scripts for COmanage Cos + +echo "# Run the job queue for CO 1 every 5 minutes" >> "${CRONFILE}" +#echo "0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd /srv/comanage-registry/app && Console/cake job -q -r -c 1 >> /tmp/cron.log" >> "${CRONFILE}" +echo "* * * * * /usr/local/bin/runcomangejob.sh 1" >> "${CRONFILE}" +echo "# Run the job queue for CO 2 every 5 minutes, but 2 minutes later than for CO 1" >> "${CRONFILE}" +echo "0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/runcomangejob.sh 2 " >> "${CRONFILE}" +echo "# TODO support an arbitrary number of COs for jobshell" >> "${CRONFILE}" +echo "# Deprecated job to run expirations, syncorgsources, and groupvalidity tasks (until Registry v4.0.0)" >> "${CRONFILE}" +echo "0 * * * * cd /srv/comanage-registry/app && Console/cake job -q" >> "${CRONFILE}" + +chmod 644 "${CRONFILE}" +crontab "${CRONFILE}" +