Skip to content

Instantly share code, notes, and snippets.

@simos
Last active June 2, 2016 21:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save simos/7ee8258ec17101e44bbfa93606694ede to your computer and use it in GitHub Desktop.
Save simos/7ee8258ec17101e44bbfa93606694ede to your computer and use it in GitHub Desktop.
#!/bin/bash
touch /tmp/Recent.xyz
while true
do
echo "Checking again..."
wget -q https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/Release -O /tmp/Release.xyz
if test /tmp/Release.xyz -nt Recent.xyz; then
mplayer /usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg
fi
sleep 5;
done
@joebalt
Copy link

joebalt commented Jun 2, 2016

Isn't InRelease.xyz always going to be newer than Recent.xyz here on the very first run? I ran your script, and it just played the sound immediately.

@simos
Copy link
Author

simos commented Jun 2, 2016

Normally, wget retains the timestamp of the file from the URL. If you have configured your locale properly on your Linux system, then it should show the original time (it is the one at 9 minutes past the hour), converted to reflect your own timezone.

To verify that the timezone is configured properly on your Ubuntu box, run

 dpkg-reconfigure tzdata

(it will show your current timezone, and allow to change it, if you wish so).

@simos
Copy link
Author

simos commented Jun 2, 2016

(the update has taken place, so Docker can again be installed properly from the Docker repositories for Debian and Ubuntu).

@simos
Copy link
Author

simos commented Jun 2, 2016

There is weird issue with the directory at https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/
If you notice, there is no file called "InRelease" shown over there.

However, if you

$ wget -S --no-cache https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/InRelease
--2016-06-02 17:27:28-- https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/InRelease
Resolving apt.dockerproject.org (apt.dockerproject.org)... 52.85.19.64
Connecting to apt.dockerproject.org (apt.dockerproject.org)|52.85.19.64|:443... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 2576
Connection: keep-alive
Date: Thu, 02 Jun 2016 13:32:44 GMT
x-amz-meta-s3cmd-attrs: uid:0/gname:root/uname:root/gid:0/mode:33188/mtime:1464865616/atime:1464826124/md5:124af13d48d3b02cea1d01d4596e73fd/ctime:1464865616
Last-Modified: Thu, 02 Jun 2016 11:09:23 GMT
x-amz-version-id: kM1R5Po2.wkPK5Ic5hT.4J_QqlmIdA3g
ETag: "124af13d48d3b02cea1d01d4596e73fd"
Server: AmazonS3
Age: 211
X-Cache: Hit from cloudfront
Via: 1.1 e5d27f3fb83b3b7e4d92ffc70e7b5a1f.cloudfront.net (CloudFront)
X-Amz-Cf-Id: W5jsFWNhTMZlkuWUqg1cwSb-7x0gYmopmAog1gMDsiI9vJlM7Tt5FQ==
Length: 2576 (2,5K) [text/plain]
Saving to: ‘InRelease’

InRelease 100%[==========================>] 2,52K --.-KB/s in 0s

2016-06-02 17:27:28 (454 MB/s) - ‘InRelease’ saved [2576/2576]

That is, Cloudfront serves a cached file, the one that used to show up earlier with the wrong checksums.
In other words, although the file InRelease is gone, Cloudfront still serves it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment