From e638a28d15efb6d2dbdd997975829b463c7ee95c Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 8 Jan 2012 02:21:21 +0100 Subject: [PATCH] Commit wiki scripts --- build-scripts/wiki/download.sh | 20 ++ build-scripts/wiki/wiki-logging.properties | 12 + .../backup_and_create.sh | 34 --- .../server_indexes_scripts/batch_indexing.sh | 26 -- .../server_indexes_scripts/batch_uploading.sh | 24 -- config/server_indexes_scripts/datecalc | 268 ------------------ .../gen_finished_mail.sh | 11 - .../upload_finished_mail.sh | 14 - config/server_indexes_scripts/weekselector | 67 ----- 9 files changed, 32 insertions(+), 444 deletions(-) create mode 100644 build-scripts/wiki/download.sh create mode 100644 build-scripts/wiki/wiki-logging.properties delete mode 100755 config/server_indexes_scripts/backup_and_create.sh delete mode 100755 config/server_indexes_scripts/batch_indexing.sh delete mode 100755 config/server_indexes_scripts/batch_uploading.sh delete mode 100755 config/server_indexes_scripts/datecalc delete mode 100755 config/server_indexes_scripts/gen_finished_mail.sh delete mode 100755 config/server_indexes_scripts/upload_finished_mail.sh delete mode 100755 config/server_indexes_scripts/weekselector diff --git a/build-scripts/wiki/download.sh b/build-scripts/wiki/download.sh new file mode 100644 index 0000000000..5805c4d69d --- /dev/null +++ b/build-scripts/wiki/download.sh @@ -0,0 +1,20 @@ +#!/bin/sh +function download { + wget -o download.log http://dumps.wikimedia.org/"$1"wiki/latest/"$1"wiki-latest-pages-articles.xml.bz2 +} +# Arabic +download ar +# English +download en +# Spanish +download es +# Portuguese +download pt +# French +download fr +# German +download de +# Russian +download ru + + diff --git a/build-scripts/wiki/wiki-logging.properties b/build-scripts/wiki/wiki-logging.properties new file mode 100644 index 0000000000..1b5a156bd9 --- /dev/null +++ b/build-scripts/wiki/wiki-logging.properties @@ -0,0 +1,12 @@ +.level = SEVERE +handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler + +# Set the default logging level for the logger named com.mycompany +net.osmand.level = ALL + +java.util.logging.FileHandler.pattern=~/wiki/work/osmand-wiki.log +java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter +java.util.logging.FileHandler.limit = 5000000 + +java.util.logging.ConsoleHandler.level=ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter diff --git a/config/server_indexes_scripts/backup_and_create.sh b/config/server_indexes_scripts/backup_and_create.sh deleted file mode 100755 index d54373b5cb..0000000000 --- a/config/server_indexes_scripts/backup_and_create.sh +++ /dev/null @@ -1,34 +0,0 @@ -if [ -n "`ps auxw | grep batch_server.xml | grep IndexBatchCreator | grep -v grep`" ]; then - echo "The gen_index process is already running!" - echo "`ps auxw | grep batch_server.xml | grep IndexBatchCreator | grep -v grep`" - exit 1 -fi -if [ -n "`ps auxw | grep batch_server_upload.xml | grep IndexBatchCreator | grep -v grep`" ]; then - echo "The upload process is already running!" - echo "`ps auxw | grep batch_server_upload.xml | grep IndexBatchCreator | grep -v grep`" - exit 1 -fi -cd ~/gen_indexes -rm osmand.log -rm console -# update map creator -rm -fr OsmAndMapCreator -mkdir -p OsmAndMapCreator -cd OsmAndMapCreator -wget http://download.osmand.net/latest-night-build/OsmAndMapCreator-development.zip -yes | unzip OsmAndMapCreator-development.zip -cd .. - -# remove backup and create new backup -# we should not rm, just do incremental updates for now! rm -rf backup -mkdir -p backup -mv indexes/uploaded/*.* backup - -# remove all previous files -rm -rf indexes -mkdir indexes -mkdir indexes/osm -mkdir indexes/uploaded - -#run batch creator -./batch_indexing.sh &> console & diff --git a/config/server_indexes_scripts/batch_indexing.sh b/config/server_indexes_scripts/batch_indexing.sh deleted file mode 100755 index 9e0e50cc1b..0000000000 --- a/config/server_indexes_scripts/batch_indexing.sh +++ /dev/null @@ -1,26 +0,0 @@ -# This file will start the Osm Extraction UI with custom memory settings for -# the JVM. With the below settings the heap size (Available memory for the application) -# will range from 64 megabyte up to 512 megabyte. - -#/usr/lib/jvm/java-6-sun/jre/bin/ -if [ -n "`ps auxw | grep batch_server.xml | grep IndexBatchCreator | grep -v grep`" ]; then - echo "The gen_index process is already running!" - echo "`ps auxw | grep batch_server.xml | grep IndexBatchCreator | grep -v grep`" - exit 1 -fi -if [ -n "`ps auxw | grep batch_server_upload.xml | grep IndexBatchCreator | grep -v grep`" ]; then - echo "The upload process is already running!" - echo "`ps auxw | grep batch_server_upload.xml | grep IndexBatchCreator | grep -v grep`" - exit 1 -fi -if [ -z "$JAVA_HOME" ] ; then - export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/ -fi -"$JAVA_HOME/bin/java" -Djava.util.logging.config.file=logging.properties \ --Dcom.sun.management.jmxremote \ --Dcom.sun.management.jmxremote.port=6789 \ --Dcom.sun.management.jmxremote.authenticate=false \ --Dcom.sun.management.jmxremote.ssl=false \ --XX:+UseParallelGC -Xmx3048M -Xmn256M -cp "OsmAndMapCreator/OsmAndMapCreator.jar:OsmAndMapCreator/lib/*.jar" net.osmand.data.index.IndexBatchCreator ./batch_server.xml -./gen_finished_mail.sh -#./batch_uploading.sh > console.upload diff --git a/config/server_indexes_scripts/batch_uploading.sh b/config/server_indexes_scripts/batch_uploading.sh deleted file mode 100755 index 34b26f3dc6..0000000000 --- a/config/server_indexes_scripts/batch_uploading.sh +++ /dev/null @@ -1,24 +0,0 @@ -# This file will start the Osm Extraction UI with custom memory settings for -# the JVM. With the below settings the heap size (Available memory for the application) -# will range from 64 megabyte up to 512 megabyte. - -#/usr/lib/jvm/java-6-sun/jre/bin/ -if [ -n "`ps auxw | grep batch_server.xml | grep IndexBatchCreator | grep -v grep`" ]; then - echo "The gen_indexes process is already running!" - echo "`ps auxw | grep batch_server.xml | grep IndexBatchCreator | grep -v grep`" - exit 1 -fi -if [ -n "`ps auxw | grep batch_server_upload.xml | grep IndexBatchCreator | grep -v grep`" ]; then - echo "The upload process is already running!" - echo "`ps auxw | grep batch_server_upload.xml | grep IndexBatchCreator | grep -v grep`" - exit 1 -fi -if [ -z "$JAVA_HOME" ] ; then - export JAVA_HOME=/usr/lib/jvm/java-6-sun/ -fi -#"$JAVA_HOME/bin/java" -version -"$JAVA_HOME/bin/java" -Djava.util.logging.config.file=logging.properties -Xms64M -Xmx768M -cp "OsmAndMapCreator/OsmAndMapCreator.jar:OsmAndMapCreator/lib/*.jar" net.osmand.data.index.IndexBatchCreator ./batch_server_upload.xml $@ -#send mail -./upload_finished_mail.sh -# update the indexes -wget "http://download.osmand.net/indexes.php?update=true" -O - > /dev/null diff --git a/config/server_indexes_scripts/datecalc b/config/server_indexes_scripts/datecalc deleted file mode 100755 index b6f0201dc6..0000000000 --- a/config/server_indexes_scripts/datecalc +++ /dev/null @@ -1,268 +0,0 @@ -#! /usr/bin/ksh - -# datecalc -- Perderabo's date calculator -# - -USAGE="\ -datecalc -a year month day - year month day -datecalc -a year month day [-|+] n -datecalc -d year month day -datecalc -D year month day -datecalc -j year month day -datecalc -j n -datecalc -l year month -use \"datecalc -help\" use for more documentation" - -DOCUMENTATION="\ - datecalc Version 1.1 - - datecalc does many manipulations with dates. - datecalc -a is for date arithmetic - datecalc -d or -D converts a date to the day of week - datecalc -j converts to date to or from julian day - datecalc -l outputs the last day of a month - - All dates must be between the years 1860 and 3999. - - datecalc -a followed by 7 parameters will calculate the - number of days between two dates. Parameters 2-4 and 6-8 - must be dates in ymd form, and parameter 5 must be a minus - sign. The output is an integer. Example: - - > datecalc -a 1960 12 31 - 1922 2 2 - 14212 - - - datecalc -a followed by 5 parameters will calculate the - a new date offset from a given date, Parameters 2-4 must - be a date in ymd form, paramter 5 must be + or -, and - paramter 6 must be an integer. Output is a new date. - Example: - - > datecalc -a 1960 12 31 + 7 - 1961 1 7 - - - datecalc -d followed by 3 parameters will convert a date - to a day-of-week. Parameters 2-4 must be a date in ymd - form. Example: - - > datecalc -d 1960 12 31 - 6 - - - datecalc -D is like -d except it displays the name of - the day. Example: - - > datecalc -D 1960 12 31 - Saturday - - - datecalc -j followed by 3 parameters will convert a date - to Modified Julian Day number. Example: - > datecalc -j 1960 12 31 - 37299 - - - datecalc -j followed by a single parameter will convert - a Modified Julian Day number to a date. Example: - > datecalc -j 37299 - 1960 12 31 - - - datecalc -l followed by year and month will output the last - day of that month. Note that by checking the last day of - February you can test for leap year. Example: - > datecalc -l 2002 2 - 28" - - -lastday() { - integer year month leap -# ja fe ma ap ma jn jl ag se oc no de - set -A mlength xx 31 28 31 30 31 30 31 31 30 31 30 31 - - year=$1 - if ((year<1860 || year> 3999)) ; then - print -u2 year out of range - return 1 - fi - month=$2 - if ((month<1 || month> 12)) ; then - print -u2 month out of range - return 1 - fi - - if ((month != 2)) ; then - print ${mlength[month]} - return 0 - fi - - leap=0 - if ((!(year%100))); then - ((!(year%400))) && leap=1 - else - ((!(year%4))) && leap=1 - fi - - feblength=28 - ((leap)) && feblength=29 - print $feblength - return 0 -} - - -date2jd() { - integer ijd day month year mnjd jd lday - - year=$1 - month=$2 - day=$3 - lday=$(lastday $year $month) || exit $? - - if ((day<1 || day> lday)) ; then - print -u2 day out of range - return 1 - fi - - ((standard_jd = day - 32075 - + 1461 * (year + 4800 - (14 - month)/12)/4 - + 367 * (month - 2 + (14 - month)/12*12)/12 - - 3 * ((year + 4900 - (14 - month)/12)/100)/4)) - ((jd = standard_jd-2400001)) - - - print $jd - return 0 -} - - -jd2dow() -{ - integer jd dow numeric_mode - set +A days Sunday Monday Tuesday Wednesday Thursday Friday Saturday - - numeric_mode=0 - if [[ $1 = -n ]] ; then - numeric_mode=1 - shift - fi - - - jd=$1 - if ((jd<1 || jd>782028)) ; then - print -u2 julian day out of range - return 1 - fi - - ((dow=(jd+3)%7)) - - if ((numeric_mode)) ; then - print $dow - else - print ${days[dow]} - fi - return -} - -jd2date() -{ - integer standard_jd temp1 temp2 jd year month day - - jd=$1 - if ((jd<1 || jd>782028)) ; then - print julian day out of range - return 1 - fi - ((standard_jd=jd+2400001)) - ((temp1 = standard_jd + 68569)) - ((temp2 = 4*temp1/146097)) - ((temp1 = temp1 - (146097 * temp2 + 3) / 4)) - ((year = 4000 * (temp1 + 1) / 1461001)) - ((temp1 = temp1 - 1461 * year/4 + 31)) - ((month = 80 * temp1 / 2447)) - ((day = temp1 - 2447 * month / 80)) - ((temp1 = month / 11)) - ((month = month + 2 - 12 * temp1)) - ((year = 100 * (temp2 - 49) + year + temp1)) - print $year $month $day - return 0 -} - - -# -# Parse parameters and get to work. -case $1 in --a) if (($# == 8)) ; then - if [[ $5 != - ]] ; then - print -u2 - "$USAGE" - exit 1 - fi - jd1=$(date2jd $2 $3 $4) || exit $? - jd2=$(date2jd $6 $7 $8) || exit $? - ((jd3=jd1-jd2)) - print $jd3 - exit 0 - elif (($# == 6)) ; then - jd1=$(date2jd $2 $3 $4) || exit $? - case $5 in - -|+) eval '(('jd2=${jd1}${5}${6}'))' - jd2date $jd2 - exit $? - ;; - *) - print -u2 - "$USAGE" - exit 1 - ;; - esac - - fi - ;; - --d|-D) if (($# != 4)) ; then - print -u2 - "$USAGE" - exit 1 - fi - jd1=$(date2jd $2 $3 $4) || exit $? - numeric=-n - [[ $1 = -D ]] && numeric="" - eval jd2dow $numeric $jd1 - exit $? - ;; - --j) if (($# == 4)) ; then - date2jd $2 $3 $4 - exit $? - elif (($# == 2)) ; then - jd2date $2 $3 $4 - exit $? - else - print -u2 - "$USAGE" - exit 1 - fi - ;; - --l) if (($# == 3)) ; then - lastday $2 $3 - exit $? - else - print -u2 - "$USAGE" - exit 1 - fi - ;; - --help) print - "$USAGE" - print "" - print - "$DOCUMENTATION" - exit 0 - ;; - -*) print -u2 - "$USAGE" - exit 0 - ;; - - -esac - -#not reached -exit 7 diff --git a/config/server_indexes_scripts/gen_finished_mail.sh b/config/server_indexes_scripts/gen_finished_mail.sh deleted file mode 100755 index b6762e0706..0000000000 --- a/config/server_indexes_scripts/gen_finished_mail.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# the CC field -echo > mail.txt -echo "Index generating finished or crashed." >> mail.txt -echo "List is sorted by time, first elements are the last created" >> mail.txt -echo >> mail.txt -ls -alrth indexes >> mail.txt - -mail -s "Generating indexes finsihed or crashed" pavol.zibrita+index@gmail.com < mail.txt -mail -s "Generating indexes finsihed or crashed" victor.shcherb+index@gmail.com < mail.txt diff --git a/config/server_indexes_scripts/upload_finished_mail.sh b/config/server_indexes_scripts/upload_finished_mail.sh deleted file mode 100755 index 1e822dfbdc..0000000000 --- a/config/server_indexes_scripts/upload_finished_mail.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# the CC field -echo > mail.txt -echo "Uploading finished or crashed." >> mail.txt -echo "Files in upload dir:" >> mail.txt -echo >> mail.txt -ls -alt indexes/uploaded >> mail.txt -echo >> mail.txt -echo "Files in indexes dir:" >> mail.txt -ls -alt indexes >> mail.txt - -mail -s "Uploading indexes finsihed or chrased" pavol.zibrita+index@gmail.com < mail.txt -mail -s "Uploading indexes finsihed or chrased" victor.shcherb+index@gmail.com < mail.txt diff --git a/config/server_indexes_scripts/weekselector b/config/server_indexes_scripts/weekselector deleted file mode 100755 index dfcf2c6e34..0000000000 --- a/config/server_indexes_scripts/weekselector +++ /dev/null @@ -1,67 +0,0 @@ -#! /usr/bin/ksh -alias datecalc=/usr/local/bin/datecalc - -# weekselector --- script to assist in scheduling cron jobs -# Perderabo Oct 11, 2003 -# -# example: -# You want to run command1 on the first monday of each month and -# you want to run command2 on the last monday of each month. -# Just use this syntax: -# -# 0 0 * * 1 /usr/local/bin/weekselector 1st && command1 -# 0 0 * * 1 /usr/local/bin/weekselector last && command2 -# -# Version 2.0 March 23, 2005 -# -# You can now use "even" or "odd" to run commands every other week. -# Whether or not a week is "even" or "odd" is arbitrary, but if one week -# is "odd", the next will be "even". An "even" Monday will be in the same -# week as an "even" Tuesday. - -integer month day year first last leap - -set -A mdy $(date "+%m %d %Y") -month=${mdy[0]} -day=${mdy[1]} -year=${mdy[2]} -#date "+%M %d %Y" | read month day year - -case $1 in - even|Even|EVEN|odd|Odd|ODD) - integer dow mjd fmjd wk - dow=$(datecalc -d $year $month $day) - mjd=$(datecalc -j $year $month $day) - ((fmjd=mjd-dow)) - ((wk=fmjd/7)) - ((wk=wk+${#1})) - ((wk/2*2 == wk)) - exit $? - ;; - 1|1st|1ST|first|First|FIRST) last=7 ;; - 2|2nd|2ND|second|Second|SECOND) last=14 ;; - 3|3rd|3RD|third|Third|THIRD) last=21 ;; - 4|4th|4TH|fourth|Fourth|FOURTH) last=28 ;; - last|Last|LAST) - # ja fe ma ap ma jn jl ag se oc no de - set -A mlength xx 31 28 31 30 31 30 31 31 30 31 30 31 - - if ((month != 2)) ; then - last=${mlength[month]} - else - leap=0 - if ((!(year%100))); then - ((!(year%400))) && leap=1 - else - ((!(year%4))) && leap=1 - fi - - last=28 - ((leap)) && last=29 - fi;; - *) exit 1;; -esac -((first=last-6)) - -((first<=day && day<=last)) -exit $?