Use of external shell script .sh and templates

My suggestions:

  1. decrease the use of hard coded shell script in js code;
exec("/usr/bin/sudo /bin/systemctl restart avahi-daemon.service..."

could be refactored to:

exec("/path/to/scripts/ restart avahi"
  1. use template files to create default daemon/system configurations;

[code]# file: etc_network_interfaces.tmpl
auto wlan0
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual