I suspect you'll find that this is due to a race condition.
- If you kill
screen
,cgminerEU
will immediately die and vice versa - You've made
pkill
send a signal to both processes
pkill
is in a race to kill the second process before it dies.
I suggest you try removing the -f
from pkill
to make it kill only by process name and not full command line.
This way, it will kill only the cgminerEU
process and not the screen
process of the same name (which will die as a dependency anyways).
PS: curl
has a -s
to avoid getting emailing the progress indicator.