Enable/Disable Network interface via command line

Start elevated Command Prompt.

Get NIC list and index number:

wmic nic get name, index

Enable NIC with index number: (eg: 7)

wmic path win32_networkadapter where index=7 call enable

Disable NIC with index number: (eg: 7)

wmic path win32_networkadapter where index=7 call disable

Thanks To EddieZA from https://answers.microsoft.com/en-us/windows/forum/windows_7-hardware/enabledisable-network-interface-via-command-line/17a21634-c5dd-4038-bc0a-d739209f5081

Add Davmail as Service Linux (Systemd)

Create file davmail-systemd on  /etc/systemd/system/davmail-systemd.service

nano /etc/systemd/system/davmail-systemd.service
[Unit]
Description=DavMail gateway service
After=syslog.target
After=network.target

[Service]
Type=simple
User=root
Group=root
ExecStart=/opt/davmail/davmail.sh /opt/davmail/davmail.properties
TimeoutSec=120

[Install]
WantedBy=multi-user.target

 

systemctl enable davmail-systemd

systemctl start davmail-systemd

We can test trafic with:

tail -f /opt/davmail/nohup.out

Thanks to https://github.com/stdevel/davmail-initscript/blob/master/davmail-systemd for systemd Script.