Commit b9c08346 authored by 段孔乐's avatar 段孔乐

modify install script

parent 7c819acf
#!/bin/bash
#logstash_host="124.71.144.118:15044"
#scan_dir="/data/backend-micro/**/*.log"
dest=/usr/share/filebeat
dest=$(cd ~ && pwd)
src="https://gitlab.33.cn/dkl/filebeat/-/archive/1.0.0/filebeat-1.0.0.tar.gz"
name=${src##*/}
......@@ -10,7 +10,7 @@ service=${folder%-*}
version=${folder#*-}
sudo systemctl stop filebeat.serivce 2>/dev/null
mkdir -p $dest
sudo mkdir -p $dest
cd $dest || exit 1
if [ -e "./$name" ]; then rm -rf $name; fi
wget $src
......
#!/bin/bash
if [ "$(pwd | grep -c 'filebeat')" -lt 0 ]; then echo "script location is incorrect, run me in filebeat installation directory"; exit 1; fi
. ./util.sh
sudo systemctl disable filebeat 2>/dev/null
sudo systemctl stop filebeat 2>/dev/null
rm -rf /etc/systemd/system/filebeat.serivce
sudo systemctl disable filebeat 2>/dev/null
sudo rm -rf /etc/systemd/system/filebeat.serivce
sudo rm -rf /etc/systemd/system/filebeat.serivce # and symlinks that might be related
sudo systemctl daemon-reload
sudo systemctl reset-failed
rm -rf "$(pwd)"
green "uninstall succeed"
......@@ -33,6 +33,7 @@ done
function initConf(){
chmod +x ./filebeat
chmod +x ./*.sh
cat > ./filebeat.yml <<-EOF
filebeat.inputs:
......@@ -70,7 +71,7 @@ Wants=network-online.target
After=network-online.target
[Service]
User=root
User=$(whoami)
ExecStart=${spath}/filebeat -c ${spath}/filebeat.yml
Restart=always
......@@ -79,7 +80,7 @@ WantedBy=multi-user.target
" > $svcpath
cp $svcpath /etc/systemd/system/
sudo cp $svcpath /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable $svcname
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment