When you log off, the system closes your login shell. The login shell is the...

When you log off, the system closes your login shell. The login shell is the parent process for your script. When the parent dies, the child processes also die. To prevent this from happening you need to pre-pend you script name with the nohup command. For example,
nohup ~/bin/testscript.sh

When you logoff, the init process will adopt the orphaned child process, and it will continue to run.

Click Here!