此问题与missing version information issue无关。
创建修改后的@echo OFF
:: Configuration Begin
SET AWS_BACKUP_NAME=Foo
SET AWS_MAX_BACKUPS=5
SET AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SET AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SET AWS_REGION=eu-west-1
SET AWS_VOLUME_ID=id-XXXXXXXXXXXXXX
:: Configuration End
:: Current path
SET CURRPATH=%cd%\
:: Get the current date/time according to os
set X=
for /f "skip=1 delims=" %%x in ('wmic os get localdatetime') do if not defined X set X=%%x
:: Set date parts
set DATE_YEAR=%X:~0,4%
set DATE_MONTH=%X:~4,2%
set DATE_DAY=%X:~6,2%
set DATE_HOUR=%X:~8,2%
set DATE_MINUTE=%X:~10,2%
set DATE_SECOND=%X:~12,2%
set DATE_FRACTIONS=%X:~15,6%
set DATE_OFFSET=%X:~21,4%
:: Set the snapshot description with AWS_BACKUP_NAME and current date/time
set SNAPSHOT_DESCRIPTION=%AWS_BACKUP_NAME%-Backup-%DATE_YEAR%-%DATE_MONTH%-%DATE_DAY%_%DATE_HOUR%-%DATE_MINUTE%-%DATE_SECOND%-%DATE_FRACTIONS%
:: Set a file for the aws-cli output
set OUTCREATESNAPSHOT="%CURRPATH%%SNAPSHOT_DESCRIPTION%.txt"
:: 1. Create the snapshot
aws ec2 create-snapshot --region %AWS_REGION% --output=text --description %SNAPSHOT_DESCRIPTION% --volume-id %AWS_VOLUME_ID% --query SnapshotId>%OUTCREATESNAPSHOT%
:: Get the snapshot id from output file
set /p SNAPSHOTID=<%OUTCREATESNAPSHOT%
:: Set the snapshot with a tag
set TAGVALUE=AutomatedBackup%AWS_BACKUP_NAME%
:: 2. Add the tag on the snapshot
aws ec2 create-tags --region %AWS_REGION% --resource %SNAPSHOTID% --tags Key=CreatedBy,Value=%TAGVALUE%
:: Set a file for the aws-cli output
set OUTSNAPSHOTS="%CURRPATH%%AWS_VOLUME_ID%_SNAPSHOTS.txt"
:: Get the snapshots with the current tag
aws ec2 describe-snapshots --region %AWS_REGION% --output=text --filters "Name=volume-id,Values=%AWS_VOLUME_ID%" "Name=tag:CreatedBy,Values=%TAGVALUE%" --query Snapshots[].SnapshotId>%OUTSNAPSHOTS%
:: 3. Loop on the reverses list but skip the first AWS_MAX_BACKUPS and delete the others
for /f "tokens=2 skip=%AWS_MAX_BACKUPS%" %%s in ('sort /r %OUTSNAPSHOTS%') do (
aws ec2 delete-snapshot --region %AWS_REGION% --snapshot-id %%s
)
(如here所述)之后,我正在尝试更新时区:
tzdata2016g.tar.gz
但我有一个例外。上面命令的输出如下:
$ sudo java -jar tzupdater.jar -v -l file:///tmp/tzupdater-2.1.0/tzdata2016g.tar.gz
如果我手动将数据提交到Using file:///tmp/tzupdater-2.1.0/tzdata2016g.tar.gz as source for tzdata bundle.
java.home: /usr/lib/jvm/java-8-oracle/jre
java.vendor: Oracle Corporation
java.version: 1.8.0_101
tzupdater version 2.1.0-b04
JRE tzdata version: tzdata2016d
Downloaded file to /tmp/tz.tmp/tzdata.tar.gz
java.io.FileNotFoundException: /tmp/tz.tmp/tzdata2016g/northamerica (Not a directory)
Exception in thread "main" com.sun.tools.tzupdater.TzRuntimeException: java.io.FileNotFoundException: /tmp/tz.tmp/tzdata2016g/northamerica (Not a directory)
at com.sun.tools.tzupdater.TimezoneUpdater.main(TimezoneUpdater.java:662)
Caused by: java.io.FileNotFoundException: /tmp/tz.tmp/tzdata2016g/northamerica (Not a directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
at com.sun.tools.tzupdater.ExternalModule.extractFiles(ExternalModule.java:103)
at com.sun.tools.tzupdater.TimezoneUpdater.run(TimezoneUpdater.java:209)
at com.sun.tools.tzupdater.TimezoneUpdater.main(TimezoneUpdater.java:643)
,/tmp/tz.tmp/tzdata2016g
会尝试在最后创建tzupdater
并使用相同的例外。
我该如何解决这个问题?
答案 0 :(得分:5)
我认为你可能在存档中添加了一个tzupdater不期望的根目录。从https://www.iana.org/time-zones/repository/releases/tzdata2016g.tar.gz下载的源tzdata文件的结构如下所示:
$ tar --list -zf tzdata2016g.tar.gz
CONTRIBUTING
...
australasia
europe
northamerica
...
leapseconds.awk
zoneinfo2tdf.pl
这就是所有文件都需要直接存档在根目录中。