Skip to content

Commit

Permalink
Ensure consistent formatting with other bash scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
minghangli-uni committed Aug 16, 2024
1 parent dbaa1a8 commit 13b751d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
12 changes: 5 additions & 7 deletions payu_config/archive_scripts/archive_cice_restarts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
# SPDX-License-Identifier: Apache-2.0
# clean up cice_restarts.sh

if [ -f archive/output*/INPUT/iced.1900-01-01-10800.nc ]
then
rm archive/output*/INPUT/iced.1900-01-01-10800.nc
return 0
if [ -f archive/output*/INPUT/iced.1900-01-01-10800.nc ]; then
rm archive/output*/INPUT/iced.1900-01-01-10800.nc
return 0
fi

latest_o=$(ls -drv archive/output*[0-9] | head -1)

#initial restart was copied from the previous run
ic_restart=$(ls -dv $latest_o/access-om3.cice.r.* | head -1)

if [ -f $latest_o/access-om3.cice.r.* ]
then
rm $latest_o/access-om3.cice.r.*
if [ -f $latest_o/access-om3.cice.r.* ]; then
rm $latest_o/access-om3.cice.r.*
fi
17 changes: 8 additions & 9 deletions payu_config/setup_scripts/setup_cice_restarts.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/bin/bash
# patch for https://github.com/open-mpi/ompi/issues/12141
if ! [ -f work/access-om3.cice.r.* ]
then
# no restart files yet, use initial conditions
IC=$(readlink work/INPUT/iced.1900-01-01-10800.nc)
rm work/INPUT/iced.1900-01-01-10800.nc
cp $IC work/INPUT/iced.1900-01-01-10800.nc
if ! [ -f work/access-om3.cice.r.* ]; then
# no restart files yet, use initial conditions
IC=$(readlink work/INPUT/iced.1900-01-01-10800.nc)
rm work/INPUT/iced.1900-01-01-10800.nc
cp $IC work/INPUT/iced.1900-01-01-10800.nc
else
# change restart symlink to hardlink
RESTART=$(echo work/access-om3.cice.r.*)
ln -f $(readlink $RESTART) $RESTART
# change restart symlink to hardlink
RESTART=$(echo work/access-om3.cice.r.*)
ln -f $(readlink $RESTART) $RESTART
fi

0 comments on commit 13b751d

Please sign in to comment.