diff --git a/geospaas_wind/daily_sync.sh b/geospaas_wind/daily_sync.sh deleted file mode 100755 index 23adb53..0000000 --- a/geospaas_wind/daily_sync.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/bash -export PROJ_LIB=$HOME/Miniconda3-4.6.14-Linux-x86_64/envs/py3openwind/share/proj -source $HOME/Miniconda3-4.6.14-Linux-x86_64/bin/activate py3openwind -cd $HOME/project - -# Sync S1A -$HOME/Miniconda3-4.6.14-Linux-x86_64/envs/py3openwind/bin/python $HOME/project/manage.py ingest_thredds_crawl http://nbstds.met.no/thredds/catalog/NBS/S1A/`date -d "yesterday 00:00" '+%Y/%m/%d'`/catalog.html - -# Sync S1B -$HOME/Miniconda3-4.6.14-Linux-x86_64/envs/py3openwind/bin/python $HOME/project/manage.py ingest_thredds_crawl http://nbstds.met.no/thredds/catalog/NBS/S1B/`date -d "yesterday 00:00" '+%Y/%m/%d'`/catalog.html - -# Sync Arome Arctic -$HOME/Miniconda3-4.6.14-Linux-x86_64/envs/py3openwind/bin/python $HOME/project/manage.py ingest_thredds_crawl https://thredds.met.no/thredds/catalog/aromearcticarchive/`date -d "yesterday 00:00" '+%Y/%m/%d'`/catalog.html --filename arome_arctic_vtk* - -# Process S1 wind -$HOME/Miniconda3-4.6.14-Linux-x86_64/envs/py3openwind/bin/python $HOME/project/manage.py process_sentinel1_wind --date `date -d "yesterday 00:00" '+%Y-%m-%d'` diff --git a/provisioning/roles/openwind/tasks/main.yml b/provisioning/roles/openwind/tasks/main.yml index 5fcd928..0b140e7 100644 --- a/provisioning/roles/openwind/tasks/main.yml +++ b/provisioning/roles/openwind/tasks/main.yml @@ -98,6 +98,35 @@ shell: "nohup /home/vagrant/run_jupyter.sh > /dev/null 2>&1 &" when: jupyter_status.rc != 0 + - name: openwind | Create shell script for daily data sync and wind processing + file: + path: /home/vagrant/daily_sync.sh + state: touch + mode: u=rwx,g=r,o=r + + - name: openwind | Sync script heading + lineinfile: + path: /home/vagrant/daily_sync.sh + insertbefore: BOF + line: "#!/bin/bash" + + - name: openwind | Sync script content + blockinfile: + path: /home/vagrant/daily_sync.sh + block: | + export PROJ_LIB={{ conda_dir }}/envs/{{ env_name }}/share/proj + source {{ conda_dir }}/bin/activate {{ env_name }} + cd {{ project_home }}/{{ project_name }} + # Sync S1A + {{ conda_dir }}/envs/{{ env_name }}/bin/python {{ project_home }}/{{ project_name }}/manage.py ingest_thredds_crawl http://nbstds.met.no/thredds/catalog/NBS/S1A/`date -d "yesterday 00:00" '+%Y/%m/%d'`/catalog.html + # Sync S1B + {{ conda_dir }}/envs/{{ env_name }}/bin/python {{ project_home }}/{{ project_name }}/manage.py ingest_thredds_crawl http://nbstds.met.no/thredds/catalog/NBS/S1B/`date -d "yesterday 00:00" '+%Y/%m/%d'`/catalog.html + # Sync Arome Arctic + {{ conda_dir }}/envs/{{ env_name }}/bin/python {{ project_home }}/{{ project_name }}/manage.py ingest_thredds_crawl https://thredds.met.no/thredds/catalog/aromearcticarchive/`date -d "yesterday 00:00" '+%Y/%m/%d'`/catalog.html --filename arome_arctic_vtk* + # Process S1 wind + {{ conda_dir }}/envs/{{ env_name }}/bin/python {{ project_home }}/{{ project_name }}/manage.py process_sentinel1_wind --date `date -d "yesterday 00:00" '+%Y-%m-%d'` + + # shell: "source activate {{ env_name }}; nohup {{ conda_dir }}/envs/{{ env_name }}/bin/jupyter-notebook --ip=0.0.0.0 --no-browser --notebook-dir=/vagrant/notebooks/ --NotebookApp.token=vagrant > /dev/null 2>&1 &" #- name: Nansat Setup Python | Check if numpy is imported