There's more...
The Ethernet interface configuration file (ifcfg-eth2) has a few other options that can be taken into account when setting up your network. Check whether it's possible to make a configuration change for your desired outcome, prior to wrapping networking in any scripts.
Interface bonds can also be created and configured in interface configuration files for use when a machine has two physical connections to the same destination to protect against either failure of the interface or cable.
One thing we didn't do was specify that the interface in question wasn't to be managed by a network manager (the network management daemon).
You can see which interfaces are and aren't being managed by the network manager using the simple nmcli device command:
$ nmcli device
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected System eth0
eth1 ethernet connected System eth1
eth2 ethernet connected System eth2
lo loopback unmanaged --
We can change this, if we'd rather the network manager does not interfere, by adding a configuration option to our ifcfg-eth2 file:
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.44.10
NETMASK=255.255.255.0
DEVICE=eth2
PEERDNS=no
NM_CONTROLLED=no
Now, go down and up your interface once more:
$ sudo ifdown eth2
$ sudo ifup eth2
Then, check out nmcli once again, this time taking note of the unmanaged status:
$ nmcli device
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected System eth0
eth1 ethernet connected System eth1
eth2 ethernet unmanaged --
lo loopback unmanaged --
If you're curious, take a look at the nmtui command for an interactive way to configure network interfaces that the network manager is aware of.