Skip to content

Instantly share code, notes, and snippets.

@dillera
Last active June 12, 2024 02:53
Show Gist options
  • Save dillera/4bbd333d8cc96b90e6a3d63b729845ba to your computer and use it in GitHub Desktop.
Save dillera/4bbd333d8cc96b90e6a3d63b729845ba to your computer and use it in GitHub Desktop.
BASH commands to save a systemd service file to start the udp_firewall.js script on boot.
cat <<'EOF' > /etc/systemd/system/udp-firewall.service
[Unit]
Description=UDP Firewall Service
After=network.target
[Service]
ExecStart=/usr/bin/node /usr/local/bin/udp_firewall.js
Restart=always
User=root
Group=root
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
EOF
........................
sudo systemctl daemon-reload
sudo systemctl enable udp-firewall.service
sudo systemctl start udp-firewall.service
sudo systemctl start udp-firewall.service
sudo systemctl stop udp-firewall.service
disable:
sudo systemctl disable udp-firewall.service
sudo systemctl enable netfilter-persistent
@dillera
Copy link
Author

dillera commented Jun 12, 2024

in /var/log/syslog....

00:00 lovo1 systemd[1]: Started udp-firewall.service - UDP Firewall Service.
00:00 lovo1 node[36049]: UDP server listening on 0.0.0.0:6677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment