update_server.sh 1.68 KB
Newer Older
1
2
3
4
5
6
#!/bin/bash
#
# FlockLab2 server update script.

USER="flocklab"
HOST="flocklab-dev-server"
Reto Da Forno's avatar
Reto Da Forno committed
7
RSYNCPARAMS="-a -z -c -K --exclude=.git"
8

9
10
11
12
if [ $# -gt 0 ]; then
    HOST=$1
fi

13
14
15
16
echo "Going to update files on FlockLab server $HOST..."
sleep 2   # give the user time to abort, just in case

# testmanagement server files
Reto Da Forno's avatar
Reto Da Forno committed
17
# optional to only look for changed files:  | grep '^<fc' | cut -d' ' -f2
Reto Da Forno's avatar
Reto Da Forno committed
18
RES=$(rsync ${RSYNCPARAMS} -i --dry-run -e 'ssh -q' testmanagementserver/ ${USER}@${HOST}:testmanagementserver  2>&1)
19
20
21
22
if [ -z "$RES" ]; then
    echo "Testmanagement server files are up to date."
else
    printf "Updating testmanagement server files... "
Reto Da Forno's avatar
Reto Da Forno committed
23
    rsync ${RSYNCPARAMS} -e 'ssh -q' testmanagementserver/ ${USER}@${HOST}:testmanagementserver
24
25
26
27
28
29
30
31
    if [ $? -ne 0 ]; then
        printf "Failed to copy files!\n"
        continue
    else
        printf "done.\n"
    fi
fi
# webserver files
Reto Da Forno's avatar
Reto Da Forno committed
32
RES=$(rsync ${RSYNCPARAMS} -i --dry-run -e 'ssh -q' webserver/ ${USER}@${HOST}:webserver  2>&1)
33
34
35
if [ -z "$RES" ]; then
    echo "Webserver files are up to date."
else
Reto Da Forno's avatar
Reto Da Forno committed
36
    echo $RES
37
    printf "Updating webserver files..."
Reto Da Forno's avatar
Reto Da Forno committed
38
    rsync ${RSYNCPARAMS} -e 'ssh -q' webserver/ ${USER}@${HOST}:webserver
39
40
41
42
43
44
45
    if [ $? -ne 0 ]; then
        printf "failed to copy repository files!\n"
        continue
    else
        printf "done.\n"
    fi
fi
Reto Da Forno's avatar
Reto Da Forno committed
46
# tools
Reto Da Forno's avatar
Reto Da Forno committed
47
RES=$(rsync ${RSYNCPARAMS} -i --dry-run -e 'ssh -q' tools/ ${USER}@${HOST}:tools  2>&1)
Reto Da Forno's avatar
Reto Da Forno committed
48
49
50
if [ -z "$RES" ]; then
    echo "Tools are up to date."
else
Reto Da Forno's avatar
Reto Da Forno committed
51
    echo $RES
Reto Da Forno's avatar
Reto Da Forno committed
52
    printf "Updating tools... "
Reto Da Forno's avatar
Reto Da Forno committed
53
    rsync ${RSYNCPARAMS} -e 'ssh -q' tools/ ${USER}@${HOST}:tools
Reto Da Forno's avatar
Reto Da Forno committed
54
55
56
57
58
59
60
    if [ $? -ne 0 ]; then
        printf "Failed to copy files!\n"
        continue
    else
        printf "done.\n"
    fi
fi