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

USER="flocklab"
HOST="flocklab-dev-server"
7
RSYNCPARAMS="-a -z -c -K --exclude=.git --no-perms --no-owner --no-group"
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
    if [ $? -ne 0 ]; then
        printf "Failed to copy files!\n"
    else
        printf "done.\n"
    fi
fi
# webserver files
Reto Da Forno's avatar
Reto Da Forno committed
31
RES=$(rsync ${RSYNCPARAMS} -i --dry-run -e 'ssh -q' webserver/ ${USER}@${HOST}:webserver  2>&1)
32
33
34
35
if [ -z "$RES" ]; then
    echo "Webserver files are up to date."
else
    printf "Updating webserver files..."
Reto Da Forno's avatar
Reto Da Forno committed
36
    rsync ${RSYNCPARAMS} -e 'ssh -q' webserver/ ${USER}@${HOST}:webserver
37
38
39
40
41
42
    if [ $? -ne 0 ]; then
        printf "failed to copy repository files!\n"
    else
        printf "done.\n"
    fi
fi
Reto Da Forno's avatar
Reto Da Forno committed
43
# tools
Reto Da Forno's avatar
Reto Da Forno committed
44
RES=$(rsync ${RSYNCPARAMS} -i --dry-run -e 'ssh -q' tools/ ${USER}@${HOST}:tools  2>&1)
Reto Da Forno's avatar
Reto Da Forno committed
45
46
47
48
if [ -z "$RES" ]; then
    echo "Tools are up to date."
else
    printf "Updating tools... "
Reto Da Forno's avatar
Reto Da Forno committed
49
    rsync ${RSYNCPARAMS} -e 'ssh -q' tools/ ${USER}@${HOST}:tools
Reto Da Forno's avatar
Reto Da Forno committed
50
51
52
53
54
55
    if [ $? -ne 0 ]; then
        printf "Failed to copy files!\n"
    else
        printf "done.\n"
    fi
fi