You could try modifying clloader - sources are in Intel® Download Center. If you stay with the clloader I'd recommend to use "systemctl stop clloader"
rather than "killall clloader" - which should also automatically stop execution of launcher.sh and sketch.elf.
Rather than starting the sketch manually you could start it with clloader again. I.E:
systemctl stop clloader #stops sketch.elf, launcher.sh, and clloader
# wait until all 3 have been stopped (e.g. check PIDs)
# rather than several ssh / scp calls you could also fuser mount Edison via sshfs and just copy over there
ssh root@$HOST "mv -f $SKETCH $OLD_SKETCH"
scp $2 root@$HOST:$SKETCH # alternatively rsync over ssh
systemctl start clloader #starts the new sketch for you