I have gone through several SE posts on the unix wait command and none of the posts resolve my problem. I have a weather forecast model to run. It has first to prepare some folders, then download data using wget, then run the forecast. The data download can take anything up to 30-60 minutes due to low speed. What happens is that when the data download starts the program goes ahead to run commands before the data is ready. Below is my crontab entry to start the run
15 09 * * * /bin/bash /home/zmumba/WRF/SCRIPTS/wrf_run_00.sh &
This is to run at 09 15 everyday, every week and every month.
The files to run in wrf_run_00.sh are
!/bin/bash
year=`date "+%Y"`
month=`date "+%m"`
day=`date "+%d"`
source /home/zmumba/.bashrc
perl /home/zmumba/WRF/SCRIPTS/wrf_Namelists_and_Dirs_00_Daily.pl
perl /home/zmumba/WRF/SCRIPTS/download-file_gen00.pl
wget --directory-prefix=/home/zmumba/WRF/DATA/${year}${month}${day}00 --background --continue --progress=bar --input-file=/home/zmumba/WRF/SCRIPTS/download-file-list-one_deg_00.txt
wait$!
cd /home/zmumba/WRF/WPS
and the rest of the commands to run the model follow. Any assistance will be appreciated.
wait$!
would throw an error! – devnull Apr 02 '14 at 07:46wait
would work. – devnull Apr 02 '14 at 07:53--background
shouldn't be used – Kiwy Apr 02 '14 at 07:57