Skip to content

Commit

Permalink
fix comanage_cron
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Sep 23, 2022
1 parent e47c027 commit 7a9aa02
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 10 deletions.
32 changes: 23 additions & 9 deletions Workbench/comanage_cron/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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


3 changes: 2 additions & 1 deletion Workbench/comanage_cron/container_files/system/root-crontab
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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}"

0 comments on commit 7a9aa02

Please sign in to comment.