Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

(RESOLVED) BASH scripts for automation

  • Thread starter Deleted member 3607
  • Start date

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

D

Deleted member 3607

Guest
Good evening everyone,

I am following a tutorial online for setting up the WPS/WRF and I would like to automate the process some in a script.
I am trying to write a IF/ELSE statement that will look at the UTC time on my desktop and round down to the nearest run.

This is what I have come up with but I can't see to get it to run.

Any help would be great!

#!/bin/bash

UTC_TIME= if [`date +%H -u` -ge 0] && [`date +%H -u` -lt 5]
then UTC_TIME=0
elif [`date +%H -u` -ge 6] && [`date +%H -u` -lt 11]
then UTC_TIME=6
elif [`date +%H -u` -ge 12] && [`date +%H -u` -lt 17]
then UTC_TIME=12
else [`date +%H -u` -ge 18] && [`date +%H -u` -lt 23]
UTC_TIME=18
fi

echo $UTC_TIME
 
Hi,
Unfortunately the wrf support team does not have the resources to support scripting that isn't part of the WRF code, but hopefully someone in the community will be able to provide some tips!
 
RESOLVED:

hour=`date +%H -u`

if [[ $hour -ge 00 && $hour -le 05 ]]; then
STARTHOUR=00
fi

if [[ $hour -ge 06 && $hour -le 11 ]]; then
STARTHOUR=06
fi

if [[ $hour -ge 12 && $hour -le 17 ]]; then
STARTHOUR=12
fi

if [[ $hour -ge 18 && $hour -le 23 ]]; then
STARTHOUR=18
fi
 
Top