12345678910111213141516171819202122232425262728293031323334 |
- #!/bin/bash
- set -e
- # NOTE: App is installed to /opt/$APP_COMPARTMENT/$APP_MODULE
- APP_COMPARTMENT="nsq-server"
- APP_MODULE="nsq-server"
- if [ $UID -ne 0 ]; then
- echo "请用root用户运行当前脚本 (su root)" && exit 1
- fi
- config_dir="/opt/$APP_COMPARTMENT/$APP_MODULE/config"
- if [ ! -d "$config_dir" ]; then
- echo "配置文件夹不存在,请检查是否安装了$APP_MODULE"
- exit
- fi
- echo "正在更新$APP_MODULE..."
- rm -rf /tmp/$APP_MODULE-tmp
- mkdir -p /tmp/$APP_MODULE-tmp
- cp -rf $config_dir /tmp/$APP_MODULE-tmp
- ./uninstall.sh
- ./install.sh
- echo "正在恢复配置文件..."
- # cp -rf /tmp/$APP_MODULE-tmp/config $config_dir
- rsync -a --delete /tmp/$APP_MODULE-tmp/config/ "$config_dir"
- chmod 777 -R $config_dir
- rm -rf /tmp/$APP_MODULE-tmp
- echo "更新完成!"
- systemctl start $APP_MODULE
- echo "$APP_MODULE 已启动"
|