Merge lp:~milo/ubuntu-it-ask/cronjob-fix into lp:ubuntu-it-ask

Proposed by Milo Casagrande
Status: Merged
Merged at revision: 66
Proposed branch: lp:~milo/ubuntu-it-ask/cronjob-fix
Merge into: lp:ubuntu-it-ask
Diff against target: 46 lines (+17/-13)
1 file modified
cronjob (+17/-13)
To merge this branch: bzr merge lp:~milo/ubuntu-it-ask/cronjob-fix
Reviewer Review Type Date Requested Status
Ubuntu-it Ask Pending
Review via email: mp+155610@code.launchpad.net

Description of the change

Rielaborato il cronjob, aggiungta funzione per impostare permessi e
proprietario di file e directory.

Altre modifiche minori.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cronjob'
2--- cronjob 2013-03-24 11:28:54 +0000
3+++ cronjob 2013-03-26 20:46:21 +0000
4@@ -1,25 +1,29 @@
5 #!/bin/bash
6+
7 WEB=/srv/chiedi.ubuntu-it.org
8 WWW=$WEB/www/osqa/
9 BZR=/srv/shared-branches
10 BZRWWW=$BZR/ubuntu-it-ask/
11 TMP_FILE=/tmp/askrepo_version
12
13-cp -ax $BZRWWW/* $WWW/
14-
15-if ! test -f $TMP_FILE ; then
16- cat /dev/null > $TMP_FILE
17+function set_own_perm {
18+ chown -R :ubuntu-it $WWW
19+ chmod -R ug+rw $WWW
20+}
21+
22+trap set_own_perm EXIT HUP QUIT TERM KILL
23+
24+if [ ! -f $TMP_FILE ]
25+then
26+ touch $TMP_FILE
27 fi
28
29 cd $BZRWWW
30-VERSION=`cat $TMP_FILE`
31-VERSION_TEST=`bzr up 2>&1 | tail -n1 `
32+OLD_VERSION=`cat $TMP_FILE`
33+NEW_VERSION=`bzr up 2>&1 | tail -n1`
34
35-if [ ! "$VERSION_TEST" = "$VERSION" ] ; then
36- echo "$VERSION_TEST" > $TMP_FILE
37+if [ ! "$NEW_VERSION" == "$OLD_VERSION" ]
38+then
39+ echo "$NEW_VERSION" > $TMP_FILE
40+ cp -ax $BZRWWW/* $WWW/
41 fi
42-
43-
44-
45-
46-

Subscribers

People subscribed via source and target branches