install.sh 783 B

12345678910111213141516171819202122232425262728293031
  1. #! /bin/bash
  2. if [ $UID -ne 0 ]; then
  3. echo "请用root用户运行当前脚本 (su root)" && exit 1
  4. fi
  5. if [ -r /opt/watch-daemon/watch-daemon ];then
  6. echo "/opt/watch-daemon/watch-daemon文件夹已存在,请重命名旧版本文件后再尝试"
  7. exit
  8. fi
  9. root_dir=/opt/watch-daemon
  10. if [ ! -d "$root_dir" ]; then
  11. mkdir -p $root_dir
  12. fi
  13. tar zxf ./watch-daemon.tar.gz -C $root_dir
  14. cp -f watch-daemon.service /usr/lib/systemd/system/
  15. if [ ! -r /opt/watch-daemon/watch-daemon ];then
  16. echo "安装失败!"
  17. exit
  18. else
  19. echo "安装成功!"
  20. fi
  21. chmod +x /opt/watch-daemon/watch-daemon/*.sh
  22. DATA_DIR=/var/lib/tsdb_data/
  23. echo -n "初始化数据目录 $DATA_DIR..."
  24. mkdir -p $DATA_DIR
  25. chmod 777 $DATA_DIR
  26. echo " 完成"
  27. systemctl daemon-reload