目前,在我的Linux Docker容器上,我有一个bash脚本,它可以通过cookie登录从特定的URL下载许多GRIB2天气预报文件。下载完这些文件后,我使用ECCODES库中的一个可执行文件(安装在同一个Docker容器中)过滤掉不需要的数据以减小文件大小。
我的公司可以访问Azure平台,我希望直接在Azure平台中下载和过滤这些GRIB2文件,这样我就不必手动运行脚本,并且总是下载文件,然后将它们上传到Azure存储。
但是,我以前从未使用过Azure,所以我想知道的是:
是否有可能在Azure虚拟机中运行此脚本,该虚拟机将直接下载过滤后的GRIB2文件并将其存储在Azure存储中(根据我目前所了解的情况,Blob存储似乎是最佳选择)?
谢谢!
发布于 2020-02-25 21:49:38
#!/usr/bin/env bash
export AZURE_STORAGE_ACCOUNT=your_azure_storage_account
export AZURE_STORAGE_ACCESS_KEY=your_azure_storage_access_key
# Retrieving current date to upload only new files
date=`date +%Y-%m-%dT%H:%MZ`
az login -u xxx@yyy.com -p password --output none
containerName=your_container_name
containerExists=`az storage container exists --account-name $AZURE_STORAGE_ACCOUNT --account-key $AZURE_STORAGE_ACCESS_KEY --name $containerName --output tsv`
if [[ $containerExists == "False" ]]; then
az storage container create --name $containerName # Create a container
fi
# Upload GRIB2 files to container
fileExists=`az storage blob exists --account-name $AZURE_STORAGE_ACCOUNT --account-key $AZURE_STORAGE_ACCESS_KEY --container-name $containerName --name "gfs.0p25.2019061300.f006.grib2" --output tsv`
if [[ $fileExists == "False" ]]; then
az storage blob upload --container-name $containerName --file ../Resources/Weather/Historical_Data/gfs.0p25.2019061300.f006.grib2 --name gfs.0p25.2019061300.f006.grib2
fihttps://stackoverflow.com/questions/60309233
复制相似问题