haproxy-wi/update.sh

77 lines
1.6 KiB
Bash
Raw Normal View History

2018-05-01 09:00:30 +00:00
#!/bin/bash
2018-05-08 09:12:16 +00:00
2018-05-01 09:00:30 +00:00
cp app/haproxy-webintarface.config /tmp/
git reset --hard
git pull https://github.com/Aidaho12/haproxy-wi.git
2018-06-24 09:31:28 +00:00
mkdir keys
2018-05-08 09:12:16 +00:00
mkdir app/certs
2018-05-01 09:00:30 +00:00
chmod +x app/*py
chmod +x app/tools/*py
2018-05-01 09:00:30 +00:00
2018-07-25 15:57:42 +00:00
at << EOF > /etc/systemd/system/multi-user.target.wants/checker_haproxy.service
[Unit]
Description=Haproxy backends state checker
After=syslog.target network.target
[Service]
Type=simple
2018-07-25 15:57:42 +00:00
WorkingDirectory=$(pwd)/app
ExecStart=$(pwd)/app/tools/checker_master.py
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=checker
RestartSec=2s
Restart=on-failure
TimeoutStopSec=1s
[Install]
WantedBy=multi-user.target
EOF
2018-07-25 15:57:42 +00:00
cat << EOF > /etc/rsyslog.d/checker.conf
if $programname startswith 'checker' then $(pwd)/log/checker-error.log
& stop
EOF
cat << EOF > /etc/logrotate.d/checker
$(pwd)/log/checker-error.log {
daily
rotate 10
missingok
notifempty
sharedscripts
}
EOF
sed -i 's/#$UDPServerRun 514/$UDPServerRun 514/g' /etc/rsyslog.conf
sed -i 's/#$ModLoad imudp/$ModLoad imudp/g' /etc/rsyslog.conf
systemctl daemon-reload
2018-07-25 15:57:42 +00:00
systemctl restart logrotate
systemctl restart rsyslog
systemctl restart checker_haproxy.service
systemctl enable checker_haproxy.service
2018-07-25 15:57:42 +00:00
chown -R apache:apache *
2018-05-01 09:00:30 +00:00
cd app/
./update_db.py
2018-05-06 17:07:13 +00:00
pip3 install -r ../requirements.txt
2018-05-01 09:00:30 +00:00
echo ""
echo "#################"
echo "Change in config:"
2018-05-07 19:09:56 +00:00
diff --expand-tabs -W 100 -y /tmp/haproxy-webintarface.config haproxy-webintarface.config
2018-05-01 09:00:30 +00:00
echo ""
echo "Please set your config"
echo ""
echo "################"
echo "Your config saved in /tmp/haproxy-webintarface.config. Please comare with new and set your env back"
echo ""