Change Request

Mike McGrath mmcgrath at redhat.com
Thu Feb 5 23:52:22 UTC 2009


If this get's +1'd tonight I'll do it tonight, if not I'll wait till
tomorrow.

Karsten had a request for the docs site to be updated more often.  We'd
initially lowered it because of a request of one of our sponsors.  It was
running hourly, during that time it did a 400M transfer so it produced
noticeable load spikes.

I've altered the script to keep a cache.  Please comment (attached)

+1's?

	-Mike
-------------- next part --------------
diff --git a/configs/web/applications/docs-sync b/configs/web/applications/docs-sync
index 5ce1850..e60057c 100644
--- a/configs/web/applications/docs-sync
+++ b/configs/web/applications/docs-sync
@@ -1,12 +1,50 @@
-#!/bin/sh
-
-TMPFILE=`mktemp -dp /var/tmp docs.XXXXXXXXXX` || exit 1
-cd $TMPFILE
+#!/bin/sh                                                                                  
 
+CACHEDIR='/var/cache/docsSite/'
 export CVSROOT=:pserver:anonymous at cvs.fedora.redhat.com:/cvs/fedora
-cvs co -r LIVE web > /dev/null 2>&1
+
+function cleanlock()
+{                   
+    /bin/rm -f /var/lock/$1.lock
+}                               
+
+
+function quit()
+{              
+    echo $1
+    if [ $2 ]
+    then
+        cleanlock $2
+    fi
+    exit 2
+}
+
+function newlock()
+{
+    if [ -f /var/lock/$1.lock ]
+    then
+        quit "Lockfile exists.. Remove /var/lock/$1.lock"
+    else
+        touch /var/lock/$1.lock
+    fi
+}
+
+newlock docSync
+if [ ! -d $CACHEDIR ]
+then
+	echo "CACHEDIR missing"
+        mkdir $CACHEDIR
+        cd $CACHEDIR
+        cvs co -r LIVE web > /dev/null 2>&1
+fi
+
+
+cd $CACHEDIR
+
+cvs up -d LIVE web > /dev/null 2>&1
 cd web
 sed -i s/project-web/web/g Makefile
+echo starting build
 make tree > /dev/null 2>&1
 cd fedoraweb
 /bin/mkdir -p /srv/web/docs/css/
@@ -19,6 +57,8 @@ cd fedoraweb
 
 # For bug #65
 rm -rf /srv/web/docs/package-list/
-rm -rf $TMPFILE
 
-/sbin/restorecon -R /srv/web
+/sbin/restorecon -R /srv/web/docs/
+/sbin/restorecon -R /srv/web/rhold/
+cleanlock docSync
+
diff --git a/configs/web/applications/docs-sync.cron b/configs/web/applications/docs-sync.cron
index 2a390ec..e0dede2 100644
--- a/configs/web/applications/docs-sync.cron
+++ b/configs/web/applications/docs-sync.cron
@@ -1 +1 @@
-05 12 * * * root /root/bin/docs-sync > /dev/null 2> /dev/null
+05 01,07,14,21 * * * root /root/bin/docs-sync > /dev/null 2> /dev/null


More information about the infrastructure mailing list