🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
* windows生成linux可执行脚步 windows\_build.bat * 其中`-w`为去掉调试信息(无法使用gdb调试),`-s`为去掉符号表(暂未清楚具体作用) ~~~ cd %GOPATH%/src/dataserver if exist "dataserver" del dataserver if exist "dataserver.zip" del dataserver.zip git pull origin master set GOPROXY=https://goproxy.cn set GO111MODULE=on set GOOS=linux set GOARCH=amd64 go build -o dataserver -ldflags "-w -s" zip.exe -r dataserver.zip dataserver if exist "dataserver" del dataserver ~~~ * 系统服务脚步 data-wechat.service * 软连接地址./etc/systemd/system/data-wechat.service * data-wechat.service -> /app/chetanlian.com/data/data-wechat.service ~~~ [Unit] Description=数据中台微信服务 # After=network.target [Install] WantedBy=multi-user.target [Service] User=root WorkingDirectory=/app/chetanlian.com/data ExecStart=/app/chetanlian.com/data/dataserver wechat ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=always RestartSec=30s ~~~ * 上传代码脚本[upload.sh](http://upload.sh) ~~~ #/bin/bash echo "BEGIN" rm -rf hmsc.zip rz systemctl stop hmsc-api.service rm -rf hmsc unzip hmsc.zip chmod 755 hmsc systemctl start hmsc-api.service rm -rf hmsc.zip echo "END" ~~~ * * * ~~~ echo "BEGIN" rm -rf /apphome/app/hmsc/dataserver/dataserver.zip rz mv dataserver.zip /apphome/app/hmsc/dataserver if [ $? -ne 0 ]; then echo "failed" exit 1 else echo "succeed" fi cd /apphome/app/hmsc/dataserver rm -rf dataserver unzip dataserver.zip chmod 755 dataserver echo "Restart..." systemctl restart data-api systemctl restart data-read systemctl restart data-wechat cd echo "END" ~~~