Try to make web item updates atomic-ish.

The Jenkins workspace is exported as the web site. So when updating files
that take time, such as making MP3, create to a temp file and rename into place.
This commit is contained in:
Jim Hague 2012-03-04 16:09:06 +00:00
parent 402d8687e2
commit 77ba1316b6
1 changed files with 11 additions and 6 deletions

View File

@ -17,16 +17,21 @@ graphicsdir=$dir/graphics/$1
mkdir -p $builddir mkdir -p $builddir
# Now, for each tune, make the tune JPG and sound. # Now, for each tune, make the tune JPG and sound. Do this to temp
# files and rename into place to make updates as atomic as possible.
find $booke -name "*.abc" | sort | find $booke -name "*.abc" | sort |
while read filename while read filename
do do
name=`basename $filename .abc` name=`basename $filename .abc`
convert $graphicsdir/${name}.eps $builddir/${name}.jpg convert $graphicsdir/${name}.eps $builddir/${name}.jpg.tmp
abc2midi $filename -o $builddir/${name}.mid abc2midi $filename -o $builddir/${name}.mid.tmp
timidity -Ow -o $builddir/${name}.wav $builddir/${name}.mid timidity -Ow -o $builddir/${name}.wav.tmp $builddir/${name}.mid.tmp
lame --quiet $builddir/${name}.wav $builddir/${name}.mp3 lame --quiet $builddir/${name}.wav.tmp $builddir/${name}.mp3.tmp
rm $builddir/${name}.wav
mv $builddir/${name}.jpg.tmp $builddir/${name}.jpg
mv $builddir/${name}.mid.tmp $builddir/${name}.mid
mv $builddir/${name}.mp3.tmp $builddir/${name}.mp3
rm $builddir/${name}.wav.tmp
done done