-
Notifications
You must be signed in to change notification settings - Fork 11
/
install.sh
36 lines (28 loc) · 1.03 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Create the folder inside /etc
sudo mkdir -p /etc/haproxy-configurator
# Copy files to the 'haproxy-configurator' folder
sudo cp -r templates/ /etc/haproxy-configurator/
sudo cp app.py /etc/haproxy-configurator/
sudo cp Makefile /etc/haproxy-configurator/
sduo cp requirements.txt /etc/haproxy-configurator/
sudo cp ssl.ini /etc/haproxy-configurator/
sudo cp -r ssl/ /etc/haproxy-configurator/
# Create the service file for 'haproxy-configurator'
cat << EOF | sudo tee /etc/systemd/system/haproxy-configurator.service
[Unit]
Description=Haproxy-Configurator Service By Alon Zur
[Service]
ExecStart=/usr/bin/python3 /etc/haproxy-configurator/app.py
Restart=always
RestartSec=3
StandardOutput=/var/log/haproxy-configurator_std_output.log
StandardError=/var/log/haproxy-configurator_error.log
[Install]
WantedBy=multi-user.target
EOF
# Reload systemd to load the new service
sudo systemctl daemon-reload
# Enable and start the service
sudo systemctl enable haproxy-configurator.service
sudo systemctl start haproxy-configurator.service