update_server.sh 1.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
#
# FlockLab2 server update script.

USER="flocklab"
HOST="flocklab-dev-server"

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

# testmanagement server files
12
RES=$(rsync -a -z -c -i --dry-run --exclude=".git" -e "ssh -q" testmanagementserver/ ${USER}@${HOST}:testmanagementserver/ | grep '^<fc' | cut -d' ' -f2)
13
14
15
16
17
18
19
20
21
22
23
24
25
if [ -z "$RES" ]; then
    echo "Testmanagement server files are up to date."
else
    printf "Updating testmanagement server files... "
    rsync -a -q -z -c --exclude=".git" -e "ssh -q" testmanagementserver ${USER}@${HOST}:
    if [ $? -ne 0 ]; then
        printf "Failed to copy files!\n"
        continue
    else
        printf "done.\n"
    fi
fi
# webserver files
26
RES=$(rsync -a -z -c -i -K --dry-run --exclude=".git" -e "ssh -q" webserver/ ${USER}@${HOST}:webserver/ | grep '^<fc' | cut -d' ' -f2)
27
28
29
30
if [ -z "$RES" ]; then
    echo "Webserver files are up to date."
else
    printf "Updating webserver files..."
31
    rsync -a -q -z -c -K --exclude=".git" -e "ssh -q" webserver ${USER}@${HOST}:
32
33
34
35
36
37
38
39
    if [ $? -ne 0 ]; then
        printf "failed to copy repository files!\n"
        continue
    else
        printf "done.\n"
    fi
fi