madsonic open ports of dlna servicer at random at each startup.
And So I attempted to script it. The next instructions labored on 2 of my Nethservers:
config set madsonic service MaxMemory 512 Name madsonic TCPPorts 4040,$(echo $(netstat -tlpn grep $(netstat -tlpn grep 4040 cut -c 80-84 awk ‘1’) cut -d “.” -f 4 cut -d “:” -f 2)) UDPPort 1900 access eco-friendly status enabled webaccess private signal-event firewall-adjust
Madsonic is really a java process, there might be more, and so i obtain the correct madsonic PID from netstat when looking for 4040.
Using the PID I grep the lines, to achieve the open madsonic ports and echo puts them in a single line.
I Then cut the fourth field with point as delimiter, the last quantity of the ip inclusive “:” and port. So just work with “:” and also the second field may be the port to open…
Whether it fails just run the following 2 lines to return to the default settings for madsonic service:
config set madsonic service MaxMemory 512 Name madsonic TCPPort 4040 access eco-friendly status enabled webaccess private signal-event firewall-adjust
When you beginOrreactivate madsonic your need to wait about ten seconds, until madsonic fully pops up before you run the command.
Labored with my LG TV with VLC on Android…