-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
33 lines (25 loc) · 849 Bytes
/
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
#!/bin/bash
# Create the folder 'simplelb' inside /etc
sudo mkdir -p /etc/simplelb
# Copy 'config.ini' to the 'simplelb' folder
sudo cp config.ini /etc/simplelb/
# Copy 'loadbalancer.py' to /usr/bin
sudo cp loadbalancer.py /usr/bin/
# Create the service file for 'simplelb' (Assuming you want a systemd service)
cat << EOF | sudo tee /etc/systemd/system/simplelb.service
[Unit]
Description=Simple Load Balancer Service By Alon Zur
[Service]
ExecStart=/usr/bin/python3 /usr/bin/loadbalancer.py
Restart=always
RestartSec=3
StandardOutput=/var/log/simplelb_std_output.log
StandardError=/var/log/simplelb_error.log
[Install]
WantedBy=multi-user.target
EOF
# Reload systemd to load the new service
sudo systemctl daemon-reload
# Enable and start the 'simplelb' service
sudo systemctl enable simplelb.service
sudo systemctl start simplelb.service