1
|
#!/bin/bash
|
2
|
#
|
3
|
# update the symlink for the stable folder
|
4
|
#
|
5
|
|
6
|
##############################################################
|
7
|
# NOTE: the ssh host should be configured in the ~/.ssh/config:
|
8
|
# Host edit-deploy
|
9
|
# HostName <ip ot host name>
|
10
|
# User <deployment-user>
|
11
|
#
|
12
|
# At the server to be delpoyed to you need to setup and configure the
|
13
|
|
14
|
# 1. crate the <deployment-user>
|
15
|
#
|
16
|
# 2. assuming you are logged in as the <deployment-user>:
|
17
|
#
|
18
|
# echo "umask 0126" >> ~/.bashrc :
|
19
|
#
|
20
|
# 3. user 'www-data' must be member of the group of the <deployment-user>
|
21
|
#
|
22
|
# 4. The permissions of the folders to delpoyed to must be set to 775 ownership must be adjusted:
|
23
|
# chmod -R 775 <the folders>
|
24
|
# chown -R www-data:deploy <the folders>
|
25
|
#
|
26
|
#
|
27
|
SSH_HOST='edit-deploy'
|
28
|
##############################################################
|
29
|
|
30
|
cd $WORKSPACE
|
31
|
PROJECT_VERSION=(`cat target/classes/version.properties | grep "cdm-webapp.version" | sed -e "s/[^0-9]*\([^\n\r]*\)/\1/g"`)
|
32
|
|
33
|
if [ -n "$PROJECT_VERSION" ]; then
|
34
|
ssh $SSH_HOST "rm -r /var/www/download/cdmserver/stable"
|
35
|
ssh $SSH_HOST "ln -s /var/www/download/cdmserver/$PROJECT_VERSION /var/www/download/cdmserver/stable"
|
36
|
fi
|
37
|
|