Skip to content

Commit

Permalink
systemd oarsh_shell fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bzizou committed Apr 12, 2024
1 parent 09a6bd2 commit 78f1c6f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions oar/tools/oarsh/oarsh_shell.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fi
# $2,$3,... = PIDs to add
# Add PIDS into the cpuset $1
function add_process_to_cpuset() {
if [ "SYSTEMD" = "1" ]
if [ "$SYSTEMD" = "1" ]
then
echo "oarsh: Using systemd" 1>&2
else
Expand Down Expand Up @@ -107,7 +107,7 @@ else
TTY=$(tty) && test -e $TTY && $OARDIR/oardodo/oardodo chown $OAR_JOB_USER:oar $TTY && $OARDIR/oardodo/oardodo chmod 660 $TTY
$OARDIR/oardodo/oardodo renice 0 $$ $PPID > /dev/null 2>&1
[ -r "$JOBENVFILE" ] && source $JOBENVFILE
if [ "SYSTEMD" = "1" ]
if [ "$SYSTEMD" = "1" ]
then
# For systemd exec, we need to pass the variables as an rcfile
RCFILE="$JOBENVFILE.rc"
Expand All @@ -119,9 +119,9 @@ else
# Simulate initial login
export OARDO_BECOME_USER=$OAR_JOB_USER
umask $OLDUMASK
if [ "SYSTEMD" = "1" ]
if [ "$SYSTEMD" = "1" ]
then
oardodo systemd-run --uid=$OAR_JOB_USER -p Delegate=yes --scope --slice $OAR_CPUSET --unit $OAR_CPUSET $DEFAULT_SHELL --rcfile $RCFILE -c "bash -l"
exec $OARDIR/oardodo/oardodo systemd-run --uid=$OAR_JOB_USER -p Delegate=yes --scope --slice $OAR_CPUSET --unit $OAR_CPUSET $DEFAULT_SHELL --rcfile $RCFILE -c "bash -l"
else
exec $OARDIR/oardodo/oardodo
#exec oardodo su - $OAR_JOB_USER
Expand All @@ -132,10 +132,10 @@ else
export OARDO_BECOME_USER=$OAR_JOB_USER
export OARDO_USE_USER_SHELL=1
umask $OLDUMASK
if [ "SYSTEMD" = "1" ]
if [ "$SYSTEMD" = "1" ]
then
# TODO: adapt to the user's shell if not bash
oardodo systemd-run --uid=$OAR_JOB_USER -p Delegate=yes --scope --slice $OAR_CPUSET --unit $OAR_CPUSET $DEFAULT_SHELL --rcfile $RCFILE "$@"
exec $OARDIR/oardodo/oardodo systemd-run --uid=$OAR_JOB_USER -p Delegate=yes --scope --slice $OAR_CPUSET --unit $OAR_CPUSET $DEFAULT_SHELL --rcfile $RCFILE "$@"
else
exec $OARDIR/oardodo/oardodo "$@"
fi
Expand Down

0 comments on commit 78f1c6f

Please sign in to comment.