deploy.sh
1.19 KB
#!/bin/bash
org_dir=`pwd`
dirpath=$(cd `dirname $0`;pwd)
cd $dirpath
bk_time=`date -I`
#docker --version
#if [ $? != 0 ];then
# echo install docker........
# dpkg -i $dirpath/libseccomp2_2.4.1-0ubuntu0.16.04.2_amd64.deb
# dpkg -i $dirpath/libltdl7_2.4.6-0.1_amd64.deb
# dpkg -i $dirpath/docker-ce_18.06.3_ce_3-0_ubuntu_amd64.deb
#fi
if [ -f $dirpath/myflask*.tar.gz ] || [ -f $dirpath/recvdata_py*.tar.gz ];then
docker load -i $dirpath/myflask*.tar.gz
if [ -d /opt/recvdata_py ];then
mv /opt/recvdata_py /opt/recvdata_py_$bk_time
fi
tar zxvf $dirpath/recvdata_py*.tar.gz -C /opt
if [ ! -f /opt/vioncfg/thrid_data/thrid_data.conf ];then
mkdir -p /opt/vioncfg/thrid_data
cp $dirpath/conf/* /opt/vioncfg/thrid_data/
fi
if [ ! -d /data/face-web/www/uploadvideo ];then
mkdir -p /data/face-web/www/uploadvideo
fi
docker run -it -v /opt/recvdata_py:/app -v /opt/vioncfg/thrid_data:/opt -v /data/face-web/www/uploadvideo:/data/www/uploadvideo -d --restart=always --name thrid_data -v /etc/localtime:/etc/localtime:ro --network host -m 10GB myflask_gunicorn:2.0 /app/Daemon/startService.sh
else
echo You need to put the [recv_data*.tar,recvdata*zip] packages in the [$dirpath] directory!
fi
cd $org_dir