source: other-projects/gti/gti-wget-status-page.sh@ 28490

Last change on this file since 28490 was 28490, checked in by ak19, 7 years ago

Committing two new scripts for processing translations, and a spelling correction to a third script. The new scripts are: 1. remove_extra_lines.sh, which is a modified version of the one Lan gave me and which strips lines that mention 'Missing translation' and 'Updated date by name'. This one makes sure not to leave empty lines behind after removing lines that only contained 'Missing translation' messages. 2. translation_status.sh, mainly to be used on nzdl's GTI installation, this script should be called by the cron to send off an email if any of the translation files in macros, gli/help, gli/classes, perllib or gsinstaller have been modified. This is needed to alert us if any translator used the GTI to update translations on nzdl. This script will send us an email. Upon receipt, we should locally process those files on nzdl that were updated by passing them through the remove_extra_lines.sh script, then commit the result to svn, and finally replace the ones on nzdl's GTI installation with the one committed to svn.

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/bash
2
3# The original version of a script by this name had gone missing
4# I have guessed at the logic it contained based on the script's name
5# of "wget-status-page"
6# This script wgets the dynamic status page at
7# http://puka.cs.waikato.ac.nz/cgi-bin/gti/library.cgi?a=gti&p=status
8# and saves it into /greenstone/custom/gti/etc/status.html so that it
9# can then be viewed statically at http://www.greenstone.org/gti/status.html
10# ak19, 17 May 2012
11
12url="http://puka.cs.waikato.ac.nz/cgi-bin/gti/library.cgi?a=gti&p=status"
13#url="http://localhost:80/cgi-bin/gti/library.cgi?a=gti&p=status"
14savedas_filename="library.cgi?a=gti&p=status"
15output_filename="etc/status.html"
16old_output_filename="$output_filename.orig"
17
18echo "WGetting translation status page from dynamic URL: $url."
19echo "This may take some time because the page, being dynamic, is first generated."
20
21# wait 10 mins=600s before giving up (at the moment it takes <5 mins to work)
22# the dynamic GTI translation status page takes quite some time to generate
23# the data, but we try only once
24if test -f $output_filename ; then
25 mv $output_filename $old_output_filename
26fi
27wget $url --tries=1 --timeout=600
28
29returnval=$?
30
31# If we succeeded, the return value is 0 and we have a file saved under
32# $savedas_filename. In that case, we get rid of the previous status page
33# If wget failed or the expected file is not saved, we keep the previous
34# day's status page, but with a log message about why.
35if [ "$returnval" == "0" ]; then
36 if test -f $savedas_filename ; then
37 mv $savedas_filename $output_filename
38 if test -f $old_output_filename ; then
39 rm $old_output_filename
40 fi
41 else
42 echo "Wget succeeded yet the expected page $savedas_filename"
43 echo "does not exist. Resorting to previous version of file $output_filename"
44 if test -f $old_output_filename ; then
45 mv $old_output_filename $output_filename
46 else
47 echo "Previous version of $output_filename does not exist either."
48 fi
49 fi
50else
51 echo "wget did not succeed in retrieving $url."
52 echo "Return value was: $returnval"
53fi
Note: See TracBrowser for help on using the repository browser.