Commit 8efd147d authored by Milo Casagrande's avatar Milo Casagrande

Reworked cronjob: added exit funxtion, samll tweaks.

parent e51a13f4
#!/bin/bash
WEB=/srv/chiedi.ubuntu-it.org
WWW=$WEB/www/osqa/
BZR=/srv/shared-branches
BZRWWW=$BZR/ubuntu-it-ask/
TMP_FILE=/tmp/askrepo_version
cp -ax $BZRWWW/* $WWW/
if ! test -f $TMP_FILE ; then
cat /dev/null > $TMP_FILE
fi
function set_own_perm {
chown -R :ubuntu-it $WWW
chmod -R ug+rw $WWW
}
cd $BZRWWW
VERSION=`cat $TMP_FILE`
VERSION_TEST=`bzr up 2>&1 | tail -n1 `
trap set_own_perm EXIT HUP QUIT TERM KILL
if [ ! "$VERSION_TEST" = "$VERSION" ] ; then
echo "$VERSION_TEST" > $TMP_FILE
if [ ! -f $TMP_FILE ]
then
touch $TMP_FILE
fi
cd $BZRWWW
OLD_VERSION=`cat $TMP_FILE`
NEW_VERSION=`bzr up 2>&1 | tail -n1`
if [ ! "$NEW_VERSION" == "$OLD_VERSION" ]
then
echo "$NEW_VERSION" > $TMP_FILE
cp -ax $BZRWWW/* $WWW/
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment