You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@infra.apache.org by "Rey Vincent Babilonia (JIRA)" <ji...@apache.org> on 2009/06/02 04:19:07 UTC

[jira] Updated: (INFRA-1506) Mirror in the Philippines

     [ https://issues.apache.org/jira/browse/INFRA-1506?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rey Vincent Babilonia updated INFRA-1506:
-----------------------------------------

    Attachment: apache_mirror.sh

Hi Henk,

We are using the attached bash script. Any suggestions would be appreciated.

Thanks.

Regards,
Rey


-- 
Import my public key from 
http://ca.grid.sinica.edu.tw/publication/newCRT/newcerts/0344.crt into 
your email client to send encrypted messages for me.

# Rey Vincent P. Babilonia
# Master of Information Systems
#           University of the Philippines Open University
#           http://www.upou.edu.ph
# Science Research Specialist I
#           Advanced Science and Technology Institute
#           http://www.asti.dost.gov.ph
# Team Lead
#           Philippine Bioinformatics Solutions Project
# Site Administrator
#           PH-ASTI Node, EUAsiaGrid Project
#           http://www.euasiagrid.eu
# Temporary Team Lead
#           Philippine e-Science Grid Infrastructure
#           http://www.psigrid.gov.ph
# Mobile    +63 917 509 3469
# Landline  +63 2 426 9760 extension 1302

#!/bin/bash

## PSciGrid Apache Mirror Synchronization Script Version 1.0
##
## This shell script synchronizes the Apache projects.
## Adapted from the mirror synchronization script by Peter Noble.

## Installation:
## 1. Copy to your working directory.
## 2. Set variables.
## 3. Set mode to executable.
## 4. Prepare local folder.
## 5. Install rsync and sendmail.
## 6. Install apache_mirrord.

## Create a lock file containing the process ID's
lockfile="/var/lock/apache_mirror.lock"
if [ -f $lockfile ]; then
    echo "Lock file present. Exiting."
    exit
fi
pid=$$
echo $pid > $lockfile

## Create a log file
logfile="/var/log/apache_mirror.log"
touch $logfile

## Configure email notification
## Set to true if you want to receive email
sendemail="true"
## Set administrator email address
adminemail="rvincent@asti.dost.gov.ph"

## Initialize some other variables
complete="false"
failures=0
status=1

## Recursively synchronize the software set
while (true); do
         while [[ "$complete" != "true" ]]; do
            start=`date`

            echo "$start - $pid - Started Apache Mirror Sync" >> $logfile
            ## If synchronization is interrupted, suspend for 2 minutes
            ## The server is probably handling too many concurrent connections
            if [[ $failures -gt 0 ]]; then
	    	echo "`date` - Encountered an error. Sleeping for 2 minutes..."
                sleep 2m
            fi

            ## Start synchronization and store ID to the lock file
            if [[ $1 == "debug" ]]; then
                echo "Working on attempt number $failures"
                rsync -auvHL --numeric-ids --timeout=600 --delete-after rsync.apache.org::apache-dist /var/www/apache >> $logfile
                status=$?
            else
                rsync -auvHL --numeric-ids --timeout=600 --delete-after rsync.apache.org::apache-dist /var/www/apache >> $logfile
		
		## Check disk utilization of the data set
                size=`du -h --max-depth=0 --time --time-style iso /var/www/apache`

                status=$?
            fi

            if [[ $status -ne "0" ]]; then
                complete="false"
                (( failures += 1 ))
            else
                finish=`date`

                ## Send an email notification
                if [[ -x /usr/bin/mail && "$sendemail" == "true" ]]; then
                    ## Set the subject
                    subject="Summary of Apache Mirror Synchronization"
                    ## Create the message
                    message="PID: $pid\nFailures: $failures\nStart Time: $start\nFinish Time: $finish\nSize: $size\n\n"
                    echo -e $message | mail -s "$subject" "$adminemail"
                fi
                complete="true"

                echo $message >> $logfile
                echo "$finish - $pid - Finished Apache Mirror Sync" >> $logfile
            fi
        done
	complete="false"
done

## Quit the mirror synchronization script
exit 0


> Mirror in the Philippines
> -------------------------
>
>                 Key: INFRA-1506
>                 URL: https://issues.apache.org/jira/browse/INFRA-1506
>             Project: Infrastructure
>          Issue Type: Improvement
>      Security Level: public(Regular issues) 
>          Components: Mirrors
>            Reporter: Rey Vincent Babilonia
>            Assignee: Henk Penning
>         Attachments: apache_mirror.sh
>
>
> URL of mirror: http://mirror.psigrid.gov.ph/apache
> Country where the mirror is located: Philippines
> Contact email address: rvincent@asti.dost.gov.ph
> Update frequency: 4x a day
> Rsync repository used: rsync.apache.org
> Approximate bandwidth: 155Mbps
> I have configured my HTTP server as requested (yes/no): yes
> I have subscribed to the mirror maintainers mailing list (yes/no): yes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.