-
Notifications
You must be signed in to change notification settings - Fork 13
/
install_multi-status.sh
65 lines (50 loc) · 1.66 KB
/
install_multi-status.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# Script created in part by ChatGPT (GPT-3.5)
# https://github.com/openai/gpt-3.5
# Original repository: https://github.com/lwindolf/multi-status
# Original author: Lars Windolf
# Contributing script author: Jeff (https://github.com/jeff89179)
# 1. Git clone https://github.com/lwindolf/multi-status.git into /
echo "Cloning multi-status repository..."
cd /
git clone https://github.com/lwindolf/multi-status.git
# 2. Install dependencies
echo "Installing dependencies..."
sudo apt-get update
sudo apt-get install -y libjson-perl libxml-feed-perl
# 3. Change directory to /multi-status/backend/
cd /multi-status/backend/
# 4. Run ./update.pl and wait for completion
echo "Running update.pl..."
./update.pl > /multi-status/frontend/data.json
# Wait until update.pl completes (you can specify a timeout)
while ! [ -f /multi-status/frontend/data.json ]
do
sleep 1
done
echo "update.pl completed."
# 5. Change directory back to /multi-status
cd /multi-status
# 6. Create a symbolic link
echo "Creating symbolic link..."
ln -s frontend multi-status
# 7. Create, start, and enable the multi-status.service
echo "Creating, starting, and enabling multi-status.service..."
cat <<EOF | sudo tee /etc/systemd/system/multi-status.service
[Unit]
Description=Multi-Status Service
After=network.target
[Service]
ExecStart=/usr/bin/python3 -m http.server --directory /multi-status
WorkingDirectory=/multi-status
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
# Reload systemd
sudo systemctl daemon-reload
# Start and enable the service
sudo systemctl start multi-status
sudo systemctl enable multi-status
echo "multi-status.service is created, started, and enabled."