pkill(1) -f "$target_dir/$main"
look up or signal processes based on name and other attributes
-f     The pattern is normally only matched against the process name.  When -f is set, the full command
       line is used.
source manpages: pkill