I'm fairly new to Linux, but I am connecting via SSH and PuTTY to a remote server, and I am running a fairly heavy MySQL script in a PHP page.
Our connection here is dodgy to say the least and I get continuous disconnections.
My question is, when I get disconnected, does my script carry on, or does it end after doing the query it was on when I get disconnected.
The problem I have, is that the first thing the PHP script does is run a big query that takes upto 10 minutes to complete, before looping through all the records.
The big query is the bit its on when I get disconnected, and I don't know whether the script is getting to the loop or not...
Hi,
A disconnection usually sends a signal (HUP = hangup) to your script. Unless your script takes care of this signal (e.g. uses the trap command) it should stop after finishing the query.
The most common way to protect a script from receiving the HUP-signal is to start it using the nohup command:
nohup /path/to/script
Input and output are redirected when you use nohup.