tests: Kill netopeer2 instances when initing tests

Change-Id: Ic08988f9269da36e97b6b0aa1861d19099e0d3fd
diff --git a/tests/init_datastore.bash.in b/tests/init_datastore.bash.in
index 51eaf1c..6eee340 100755
--- a/tests/init_datastore.bash.in
+++ b/tests/init_datastore.bash.in
@@ -27,6 +27,10 @@
 BACKEND="$1"
 shift
 if [[ "$BACKEND" = "netconf" ]]; then
+    # Kill previous instances of Netopeer2 that are associated with this test. These can appear when you run tests and
+    # press CTRL-C before let the cleanup tests run.
+    pkill -f "${SYSREPO_SHM_PREFIX}_netopeer2-server" || true
+
     NETOPEER2="@NETOPEER2_EXECUTABLE@"
     # Setup netopeer config
     "$SYSREPOCFG" --import --datastore=running --format=xml --module=ietf-netconf-server <<< ""