-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·42 lines (34 loc) · 1.02 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
37
38
39
40
41
42
#!/bin/bash
# Exit on error
set -e
echo "Installing RouterPing..."
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "Please run as root (use sudo)"
exit 1
fi
# Copy files to their proper locations
echo "Copying files..."
cp router_ping.py /usr/local/bin/
cp router_ping.ini /etc/
cp router_ping.service /etc/systemd/system/
# Make the script executable
chmod +x /usr/local/bin/router_ping.py
# Create log file with proper permissions
touch /var/log/router_ping.log
chmod 644 /var/log/router_ping.log
# Reload systemd, enable and start the service
echo "Enabling and starting service..."
systemctl daemon-reload
systemctl enable router_ping.service
systemctl start router_ping.service
echo "Installation complete!"
echo "The service is now running. You can check its status with:"
echo " systemctl status router_ping.service"
echo ""
echo "You can view logs with:"
echo " journalctl -u router_ping.service"
echo " or"
echo " cat /var/log/router_ping.log"
echo ""
echo "Edit configuration at /etc/router_ping.ini as needed"