So sometimes my Mac loses its connection to the Internet.
When I'm in front of it physically I can use the terminal and do the following to repair it:
networksetup -setnetworkserviceenabled ethernet off
type my password then:
networksetup -setnetworkserviceenabled ethernet on
and type my password again.
The thing is the machine is hosting several servers and I need them to be running even when I'm not physically present. So I wanted to run a daily script that would do this when I'm not present and be sure the connection is reset at least once a day. But since I haven't figured out a way to include my password in the command line I can't do that.
So my question is: is it possible to do what I described?