Skip to content

Commit

Permalink
Merge pull request #1564 from todor-ivanov/WMAgent_CrontabsVenvDiff_f…
Browse files Browse the repository at this point in the history
…ix-12166

Avoid -u parameter when using the OS crontab for WMAgent
  • Loading branch information
todor-ivanov authored Nov 25, 2024
2 parents 252ed31 + db6b594 commit 1469215
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions docker/pypi/wmagent/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,17 @@ set_cronjob() {
echo "Start: $stepMsg"
local errVal=0

# Avoid -u parameter when using the OS crontab
_is_venv && crontabParams="" || crontabParams="-u $WMA_USER"

# Activate the environment if cronjobs are to run under virtual env
_is_venv && crontabEnvStr="source $WMA_ROOT_DIR/bin/activate > /dev/null && " || crontabEnvStr=""

# Populating proxy related cronjobs
crontab -u $WMA_USER - <<EOF
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 2>&1 >> $WMA_LOG_DIR/component-restart.log
crontab $crontabParams - <<EOF
55 */12 * * * $crontabEnvStr date -Im >> $WMA_LOG_DIR/renew-proxy.log && $WMA_MANAGE_DIR/manage renew-proxy 2>&1 >> $WMA_LOG_DIR/renew-proxy.log
58 */12 * * * $crontabEnvStr python $WMA_DEPLOY_DIR/deploy/checkProxy.py --proxy $X509_USER_PROXY --time 120 --send-mail True --mail [email protected]
*/15 * * * * $crontabEnvStr source $WMA_DEPLOY_DIR/deploy/restartComponent.sh 2>&1 >> $WMA_LOG_DIR/component-restart.log
EOF
let errVal+=$?

Expand Down

0 comments on commit 1469215

Please sign in to comment.