Skip to content

Instantly share code, notes, and snippets.

@Mitrajit
Last active January 14, 2024 01:01
Show Gist options
  • Save Mitrajit/64c2f8b073d265118f3c98a42c536061 to your computer and use it in GitHub Desktop.
Save Mitrajit/64c2f8b073d265118f3c98a42c536061 to your computer and use it in GitHub Desktop.
ip_address=$(ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
# Check if we got the IP address
if [ -z "$ip_address" ]; then
echo "No IP address found for eth0"
exit 1
fi
#!/bin/bash
CURRENT_PATH=$(echo $PATH)
echo "[Unit]
Description=Manages SSD
After=network.target
[Service]
ExecStart=/etc/systemd/system/go-dispatch-proxy -lhost 0.0.0.0 -lport 2052 $ip_address
Environment=PATH=$CURRENT_PATH
Restart=always
User=root
Group=root
WorkingDirectory=/etc/systemd/system/
[Install]
WantedBy=multi-user.target
" > go-dispatch-proxy.service
# Download the binary
wget https://archive.org/download/go-dispatch-proxy/go-dispatch-proxy
# Copy the binary
cp go-dispatch-proxy /etc/systemd/system/
# Copy the service file
cp go-dispatch-proxy.service /etc/systemd/system/
# Reload systemd
systemctl daemon-reload
# Start the service
systemctl start go-dispatch-proxy
# Enable the service to start on boot
systemctl enable go-dispatch-proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment