From 5e1fe4d416f1ff18ab5ed6c8a52f333d82e1ea2b Mon Sep 17 00:00:00 2001 From: Daniel Abdi Date: Wed, 7 Dec 2022 12:50:53 -0700 Subject: [PATCH] Fix crontab unspecified USER issue. --- ush/rocoto_fake_slurm/sacct | 5 +++-- ush/rocoto_fake_slurm/squeue | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ush/rocoto_fake_slurm/sacct b/ush/rocoto_fake_slurm/sacct index 818765d990..fff885b03f 100755 --- a/ush/rocoto_fake_slurm/sacct +++ b/ush/rocoto_fake_slurm/sacct @@ -16,6 +16,7 @@ for pid in ${PIDS}; do t_start=$t_sub t_end=$t_sub name=$pid + user=${USER:-user} v=$(cat .job_database | grep "pid $pid submitted" | awk '{print $1" "$5}') if [ ! -z "$v" ]; then @@ -27,8 +28,8 @@ for pid in ${PIDS}; do fi if [ -z "$v" ]; then - printf "$FMT" $pid ${USER:0:30} ${name:0:30} linux 0.1 $t_sub $t_start $t_end 1 0 RUNNING + printf "$FMT" $pid ${user:0:30} ${name:0:30} linux 0.1 $t_sub $t_start $t_end 1 0 RUNNING else - printf "$FMT" $pid ${USRE:0:30} ${name:0:30} linux 0.1 $t_sub $t_start $t_end 1 $v COMPLETED + printf "$FMT" $pid ${user:0:30} ${name:0:30} linux 0.1 $t_sub $t_start $t_end 1 $v COMPLETED fi done diff --git a/ush/rocoto_fake_slurm/squeue b/ush/rocoto_fake_slurm/squeue index ccd37ce7f1..5c18b582b2 100755 --- a/ush/rocoto_fake_slurm/squeue +++ b/ush/rocoto_fake_slurm/squeue @@ -16,6 +16,7 @@ for pid in ${PIDS}; do t_start=$t_sub t_end=$t_sub name=$pid + user=${USER:-user} v=$(cat .job_database | grep "pid $pid submitted" | awk '{print $1" "$5}') if [ ! -z "$v" ]; then @@ -27,8 +28,8 @@ for pid in ${PIDS}; do fi if [ -z "$v" ]; then - printf "$FMT" $pid $USER 1 linux $t_sub $t_start $t_end 0.1 0 RUNNING $name + printf "$FMT" $pid $user 1 linux $t_sub $t_start $t_end 0.1 0 RUNNING $name else - printf "$FMT" $pid $USER 1 linux $t_sub $t_start $t_end 0.1 $v COMPLETED $name + printf "$FMT" $pid $user 1 linux $t_sub $t_start $t_end 0.1 $v COMPLETED $name fi done