Skip to content

Commit

Permalink
Start cron daemon with root externally upon docker run (#1506)
Browse files Browse the repository at this point in the history
* Start cron daemon with root externally upon docker run

Switch from /etc/init.d/cron to service command

* Preserve the env for the cron daemon && Add --only-cron for wmagent-couchapp-init && Add timestamps
  • Loading branch information
todor-ivanov authored Jun 17, 2024
1 parent 6157fcc commit 38842cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docker/pypi/wmagent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,8 @@ EOF
# allow dynamic users to create homefolders and .bashrc
RUN chmod 777 /home

# preserve the whole env for later use by the cron daemon
RUN env > /etc/environment

# Define the entrypoint (Using exec form):
ENTRYPOINT ["./run.sh", "2>&1"]
5 changes: 3 additions & 2 deletions docker/pypi/wmagent/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ echo " - WMAgent Number : $AGENT_NUMBER"
echo " - WMAgent Relational DB type : $AGENT_FLAVOR"
echo " - Python Version : $(python --version)"
echo " - Python Module path : $pythonLib"
echo " - Current time : $(date -Im)"
echo "======================================================="
echo

Expand Down Expand Up @@ -324,14 +325,14 @@ set_cronjob() {

# Populating proxy related cronjobs
crontab -u $WMA_USER - <<EOF
55 */12 * * * $WMA_MANAGE_DIR/manage renew-proxy
55 */12 * * * date -Im >> $WMA_LOG_DIR/renew-proxy.log && $WMA_MANAGE_DIR/manage renew-proxy 2>&1 >> $WMA_LOG_DIR/renew-proxy.log
58 */12 * * * python $WMA_DEPLOY_DIR/deploy/checkProxy.py --proxy /data/certs/myproxy.pem --time 120 --send-mail True --mail [email protected]
*/15 * * * * source $WMA_DEPLOY_DIR/deploy/restartComponent.sh > /dev/null
EOF
let errVal+=$?

# Populating CouchDB related cronjobs
wmagent-couchapp-init
wmagent-couchapp-init --only-cron
let errVal+=$?

[[ $errVal -eq 0 ]] || {
Expand Down
1 change: 1 addition & 0 deletions docker/pypi/wmagent/wmagent-docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,4 @@ echo "Checking if there is no other wmagent container running and creating a lin

echo "Starting wmagent:$WMA_TAG docker container with user: $wmaUser:$wmaGroup"
docker run $dockerOpts $registry/$repository:$WMA_TAG
docker exec -u root -it wmagent service cron start

0 comments on commit 38842cd

Please sign in to comment.