Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

cdm-server / src / main / jenkins-ci / copy-cdmserver-and-restart.sh @ 7467b5a1

History | View | Annotate | Download (1.35 KB)

1
#!/bin/bash -x
2
#
3
# prior using this script make sure the required sudo
4
# commands are allowed in /etc/sudoers by allowing the
5
# following the below used commands to be executed without
6
# password. Add the following enties to /etc/sudoers: 
7
# ------------------------------------------------------------
8
#   User_Alias      CDMUSERS = jenkins
9
#   Cmnd_Alias      CDMSERVER = /bin/cp -f cdm-server*.jar /opt/cdmserver/, /etc/init.d/cdmserver *, /bin/rm -f /opt/cdmserver/cdm-server.jar, /bin/ln -s cdm-server*.jar cdm-server.jar
10
#   CDMUSERS        ALL=(ALL)NOPASSWD: CDMSERVER
11
# ------------------------------------------------------------
12

    
13
#TARGET_DIR="/home/andreas/workspaces/_svn-trunk/cdm-server/target"
14
if [ -z $TARGET_DIR ]; then
15
  TARGET_DIR="$WORKSPACE/cdm-server/target"
16
fi
17
if [ -z $CDMSERVER_HOME ]; then
18
  CDMSERVER_HOME="/opt/cdmserver"
19
fi
20
echo "copy-cdmserver-and-restart:"
21
echo "  TARGET_DIR="$TARGET_DIR
22
echo "  CDMSERVER_HOME="$CDMSERVER_HOME
23

    
24
cd "${TARGET_DIR}"
25

    
26
CDMSERVER_JAR=$(ls -1 | grep cdm-server.*jar | grep -v sources)
27

    
28
if [ ! -e $CDMSERVER_JAR ]
29
then
30
    echo "cdmserver*.jar missing in target folder"
31
    exit 1
32
fi
33

    
34
sudo /etc/init.d/cdmserver stop
35
sudo -u cdm /bin/rm -f /opt/cdmserver/cdm-server.jar
36
sudo -u cdm /bin/cp -f $CDMSERVER_JAR /opt/cdmserver/
37
cd $CDMSERVER_HOME
38
sudo -u cdm /bin/ln -s $CDMSERVER_JAR cdm-server.jar
39
sudo /etc/init.d/cdmserver start
Add picture from clipboard (Maximum size: 40 MB)