Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
cron_runjobs.sh: adds setsid to timeout command
Bug 1305544
https://bugzilla.redhat.com/show_bug.cgi?id=1305544

Currently, cron jobs in OpenShift Online inherit the session from
/usr/libexec/openshift/cartridges/cron/bin/cron_runjobs.sh , which has SELinux
label system_u:system_r:system_cronjob_t:s0-s0:c0.c1023

This process is called under runcon, but only the child processes get a new
label (unconfined_u:system_r:openshift_t:s0:cXXX,cYYY).  Because of the label
change, calling getpgid against the sid fails.

Adds a 'setsid' to the run-parts command to resolve the issue.
  • Loading branch information
thrasher-redhat committed Feb 16, 2016
1 parent e95055b commit cdd56c5
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -64,10 +64,10 @@ log_message ":START: $freq cron run for openshift user '$OPENSHIFT_GEAR_UUID'"
SCRIPTS_DIR="$OPENSHIFT_REPO_DIR/.openshift/cron/$freq"
if [ -d "$SCRIPTS_DIR" ]; then
# Run all scripts in the scripts directory serially.
executor="run-parts"
executor="setsid run-parts"
if [ -n "$MAX_RUN_TIME" ]; then
# TODO: use signal -s 1 --kill-after=$KILL_AFTER_TIME" when available
executor="timeout -s 9 $MAX_RUN_TIME run-parts"
executor="setsid timeout -s 9 $MAX_RUN_TIME run-parts"
fi

(
Expand Down

0 comments on commit cdd56c5

Please sign in to comment.