[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [collector/master] Add create-tarball script from main CollecTor instance to resources.
commit 7aa2fb51dda480e2e2bdf0a384824d1351c860f5
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
Date: Tue Jul 12 13:07:40 2016 +0200
Add create-tarball script from main CollecTor instance to resources.
Initial check-in.
---
src/main/resources/create-tarballs.sh | 75 +++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
diff --git a/src/main/resources/create-tarballs.sh b/src/main/resources/create-tarballs.sh
new file mode 100644
index 0000000..f3f55a2
--- /dev/null
+++ b/src/main/resources/create-tarballs.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+echo `date` "Starting"
+YEARONE=`date +%Y`
+MONTHONE=`date +%m`
+YEARTWO=`date --date='7 days ago' +%Y`
+MONTHTWO=`date --date='7 days ago' +%m`
+cd tarballs/
+
+TARBALLS=(
+ exit-list-$YEARONE-$MONTHONE
+ exit-list-$YEARTWO-$MONTHTWO
+ torperf-$YEARONE-$MONTHONE
+ torperf-$YEARTWO-$MONTHTWO
+ certs
+ microdescs-$YEARONE-$MONTHONE
+ microdescs-$YEARTWO-$MONTHTWO
+ consensuses-$YEARONE-$MONTHONE
+ consensuses-$YEARTWO-$MONTHTWO
+ votes-$YEARONE-$MONTHONE
+ votes-$YEARTWO-$MONTHTWO
+ server-descriptors-$YEARONE-$MONTHONE
+ server-descriptors-$YEARTWO-$MONTHTWO
+ extra-infos-$YEARONE-$MONTHONE
+ extra-infos-$YEARTWO-$MONTHTWO
+ bridge-descriptors-$YEARONE-$MONTHONE
+ bridge-descriptors-$YEARTWO-$MONTHTWO
+)
+TARBALLS=($(printf "%s\n" "${TARBALLS[@]}" | uniq))
+
+DIRECTORIES=(
+ ../out/exit-lists/$YEARONE/$MONTHONE/
+ ../out/exit-lists/$YEARTWO/$MONTHTWO/
+ ../out/torperf/$YEARONE/$MONTHONE/
+ ../out/torperf/$YEARTWO/$MONTHTWO/
+ ../out/relay-descriptors/certs/
+ ../out/relay-descriptors/microdesc/$YEARONE/$MONTHONE
+ ../out/relay-descriptors/microdesc/$YEARTWO/$MONTHTWO
+ ../out/relay-descriptors/consensus/$YEARONE/$MONTHONE
+ ../out/relay-descriptors/consensus/$YEARTWO/$MONTHTWO
+ ../out/relay-descriptors/vote/$YEARONE/$MONTHONE/
+ ../out/relay-descriptors/vote/$YEARTWO/$MONTHTWO/
+ ../out/relay-descriptors/server-descriptor/$YEARONE/$MONTHONE/
+ ../out/relay-descriptors/server-descriptor/$YEARTWO/$MONTHTWO/
+ ../out/relay-descriptors/extra-info/$YEARONE/$MONTHONE/
+ ../out/relay-descriptors/extra-info/$YEARTWO/$MONTHTWO/
+ ../out/bridge-descriptors/$YEARONE/$MONTHONE/
+ ../out/bridge-descriptors/$YEARTWO/$MONTHTWO/
+)
+DIRECTORIES=($(printf "%s\n" "${DIRECTORIES[@]}" | uniq))
+
+for (( i = 0 ; i < ${#TARBALLS[@]} ; i++ )); do
+ if [ ! -d ${TARBALLS[$i]} ]; then
+ echo `date` "Creating symlink for" ${TARBALLS[$i]}
+ ln -s ${DIRECTORIES[$i]} ${TARBALLS[$i]}
+ else
+ # This is a workaround for the "tar u" bug in GNU tar 1.20
+ echo `date` "Touching symlink and directories for" ${TARBALLS[$i]}
+ find -L ${TARBALLS[$i]} -type d | xargs touch
+ fi
+done
+
+for (( i = 0 ; i < ${#TARBALLS[@]} ; i++ )); do
+ echo `date` "Creating" ${TARBALLS[$i]}'.tar'
+ tar chf ${TARBALLS[$i]}.tar ${TARBALLS[$i]}
+ if [ ! -f ${TARBALLS[$i]}.tar.xz ]; then
+ echo `date` "Compressing" ${TARBALLS[$i]}'.tar'
+ xz -9e ${TARBALLS[$i]}.tar
+ fi
+done
+
+echo `date` "Moving tarballs into place"
+mv *.tar.xz ../data/
+
+cd ..
+echo `date` "Finishing"
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits