Skip to content

Commit

Permalink
Submit commands in background, optionally prepend nohup if bash is sp…
Browse files Browse the repository at this point in the history
…ecified
  • Loading branch information
danielhollas committed Apr 30, 2024
1 parent 3b57b16 commit b5ce74a
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions utils/create_trajectories.sh
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,22 @@ done
# Submit jobs
k=1
if [[ -n "${submit_command-}" ]];then
cd $folder || exit 1
while [[ $k -le $j ]]
do
if [[ -f $folder.$isample.$k.sh ]];then
$submit_command $folder.$isample.$k.sh
fi
(( k++ ))
done
cd $folder || exit 1
if [[ $submit_command = "bash" ]];then
echo "Launching $j calculations locally"
submit_command="nohup $submit_command"
else
echo "Submitting $j calculations with: $submit_command"
fi
while [[ $k -le $j ]]
do
if [[ -f $folder.$isample.$k.sh ]];then
$submit_command $folder.$isample.$k.sh &
fi
(( k++ ))
done
# Wait for submit commands to finish (they should be fast!)
if [[ $submit_command != "bash" ]]; then
wait
fi
fi

0 comments on commit b5ce74a

Please sign in to comment.