# 部署步骤







# 配置文件

### java后端

```
DATE=$(date +%Y%m%d)
export JAVA_HOME PATH CLASSPATH
JAVA_HOME=/usr/local/jdk1.8
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
APPNAME=wisdom-platform
DIR=/root/java/publish
JARFILE=$APPNAME.jar
if [ ! -d $DIR/backup ];then
   mkdir -p $DIR/backup
fi
cd $DIR
pwd
pid=`ps -ef | grep $APPNAME.jar | grep -v grep | awk '{print $2}'`
echo $pid
if [ -n "$pid" ];
then
kill -9 $pid
fi
echo "kill done"
if [ -f "$JARFILE" ];
then
mv $JARFILE backup/$JARFILE$DATE
fi
mv -f /var/lib/jenkins/workspace/$APPNAME/target/$JARFILE .

nohup java -Xms128m -Xmx512m -jar $JARFILE --spring.profiles.active=test > $APPNAME.log &
if [ $? = 0 ];then
        sleep 30
        tail -n 50 $APPNAME.log
fi
cd backup/
ls -lt|awk 'NR>5{print $NF}'|xargs rm -rf
```

### vue前端

```
DATE=$(date +%Y%m%d)
DIR=/root/web/wisdom-saas/public
npm install
npm run build
if [ -d "$DIR" ];
then
rm -rf $DIR$DATE
mv $DIR $DIR$DATE
fi
mv dist $DIR
```
