Last active
November 13, 2016 23:08
-
-
Save yodeah/388ed32dce1fb050328103923a933116 to your computer and use it in GitHub Desktop.
install java and monitor repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install python-software-properties | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java8-installer | |
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" | |
sudo apt-get install unzip | |
unzip awscli-bundle.zip | |
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws | |
aws configure | |
#YOU have to add them params | |
aws s3api get-object --bucket tesztjarhw --key testhellowordldserver.jar test.jar | |
perl -MFile::stat -e "print scalar localtime stat('test.jar')->mtime" > last_change.txt | |
last modified | |
http://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html | |
--if-modified-since (timestamp) Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified). | |
és ha ez nem 304 akk a leszedettet futtassa a régit meg előtte állítsa le |
#!/bin/sh
folder_to_download_file_to="/home/ubuntu/bucket/"
file_to_download="test.jar"
if [ -f $folder_to_download_file_to$file_to_download ]
then
echo "found file"
last_mod=$(perl -MFile::stat -e "print scalar localtime stat('test.jar')->mtime")
echo "file last modified: "$last_mod
out_of_download=$(aws s3api get-object --bucket tesztjarhw --key testhellowordldserver.jar --if-modified-since "$last_mod" test.jar)
echo $out_of_download
echo -e $out_of_download > $file_to_download".data"
else
echo "didnt find file, will download it"
out_of_download=$(aws s3api get-object --bucket tesztjarhw --key testhellowordldserver.jar test.jar)
echo $out_of_download
echo $out_of_download > $file_to_download".data"
fi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
aws s3api get-object --bucket tesztjarhw --key testhellowordldserver.jar --if-modified-since "Sat, 05 Nov 2015 13:13:05 GMT" test.jar