Project

General

Profile

1 24971 mateusz.ko
#!/bin/bash
2
# Simple script to deploy the UI files on the server
3
4
trap "echo \"ERROR: One of the commands failed\"; exit 1" ERR #place trap
5
6
SERVER=oscypek
7
COMMON_DIR_SRC=common
8
COMMON_DIR_DST=/srv/oapdemonstrators
9
DOCSIM_DIR_SRC=docsim
10
DOCSIM_DIR_DST=/srv/$DOCSIM_DIR_SRC
11
CITMATCHING_DIR_SRC=citationmatching
12
CITMATCHING_DIR_DST=/srv/$CITMATCHING_DIR_SRC
13
14
function copy_dir {
15
	DIR_SRC=$1
16
	DIR_DST=$2
17
	echo "Copying $DIR_SRC to $SERVER:$DIR_DST"
18
	CWD=$(pwd)
19
	cd $DIR_SRC
20
	ssh $SERVER "cd $DIR_DST; rm -r *"
21
	scp -r * $SERVER:$DIR_DST/
22
	ssh $SERVER "cd $DIR_DST; chmod g+w *"
23
	cd $CWD
24
}
25
26
copy_dir $DOCSIM_DIR_SRC $DOCSIM_DIR_DST
27
copy_dir $CITMATCHING_DIR_SRC $CITMATCHING_DIR_DST
28
copy_dir $COMMON_DIR_SRC $COMMON_DIR_DST
29
30
trap - ERR #remove trap
31
echo "DONE - everything's OK"