Skip to content

Commit 38842cd

Browse files
authored
Start cron daemon with root externally upon docker run (#1506)
* 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
1 parent 6157fcc commit 38842cd

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

docker/pypi/wmagent/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,8 @@ EOF
6262
# allow dynamic users to create homefolders and .bashrc
6363
RUN chmod 777 /home
6464

65+
# preserve the whole env for later use by the cron daemon
66+
RUN env > /etc/environment
67+
6568
# Define the entrypoint (Using exec form):
6669
ENTRYPOINT ["./run.sh", "2>&1"]

docker/pypi/wmagent/init.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ echo " - WMAgent Number : $AGENT_NUMBER"
5959
echo " - WMAgent Relational DB type : $AGENT_FLAVOR"
6060
echo " - Python Version : $(python --version)"
6161
echo " - Python Module path : $pythonLib"
62+
echo " - Current time : $(date -Im)"
6263
echo "======================================================="
6364
echo
6465

@@ -324,14 +325,14 @@ set_cronjob() {
324325

325326
# Populating proxy related cronjobs
326327
crontab -u $WMA_USER - <<EOF
327-
55 */12 * * * $WMA_MANAGE_DIR/manage renew-proxy
328+
55 */12 * * * date -Im >> $WMA_LOG_DIR/renew-proxy.log && $WMA_MANAGE_DIR/manage renew-proxy 2>&1 >> $WMA_LOG_DIR/renew-proxy.log
328329
58 */12 * * * python $WMA_DEPLOY_DIR/deploy/checkProxy.py --proxy /data/certs/myproxy.pem --time 120 --send-mail True --mail alan.malta@cern.ch
329330
*/15 * * * * source $WMA_DEPLOY_DIR/deploy/restartComponent.sh > /dev/null
330331
EOF
331332
let errVal+=$?
332333

333334
# Populating CouchDB related cronjobs
334-
wmagent-couchapp-init
335+
wmagent-couchapp-init --only-cron
335336
let errVal+=$?
336337

337338
[[ $errVal -eq 0 ]] || {

docker/pypi/wmagent/wmagent-docker-run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,4 @@ echo "Checking if there is no other wmagent container running and creating a lin
132132

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

0 commit comments

Comments
 (0)