Ubuntu SSH behavior
I'm about a 3/10 on Linux skill wise,
Quick question, I'm on Ubuntu 12.04.3, I'm running it on my Linode,
Anyway, I am basically running two php scripts to monitor a database and send push notifications for my iPhone app.
So I log in via ssh, kick off the php scripts and use an ampersands to put the task in the background, my question is when I terminate my ssh session, the two php tasks continue to run in the back ground, (I know this because push notifications continue to arrive), however a linux 'expert' buddy of mine tells me this can't be the case and I need to use 'screen' or 'tmux'.
But the evidence is that the processes don't end when I end the ssh session (which was a root session for what it's worth).
The scripts are pretty simple PHP e.g.
Monitor a web feed
Loop through an array
Write to local database
So nothing special, I just start them with "php script.php&"
So I'm not daemonizing to my knowledge…
This is really strange,
So I login last night at home (after a week or so of setting up a LAMP stack and configuring everything).
I just use my Mac running OS X, open terminal and type ssh
I enter password and i'm in, kick off the php scripts.
I shutdown my Mac, and the push notifications are working on my iOS app (which can literally only happen if the php scripts are running).
When I log in from work this morning using a non root user 'user1' I type, 'who' and can only see myself as logged in,
Then when I type 'PS -A | grep -i php'
I see the two php processes running like this:
****6363 ? 00:00:02 php
6364 ? 00:00:02 php****
infact nearly all processes in PS have ? as tty,
does this sound normal, any idea what's going on?
Thanks for your help! - I'm happy with what's happening, but wanted to check that these processes won't just die at some point,
so is my buddy right?
I literally just type "php script.php&"
at the prompt.
Here is one of the scripts:
It can be brought to foreground by fg, that's it right?
@derfy, What do you mean no fair?
So are my jobs going to be ok running in the background, it seems my ssh session when disconnected does NOT end jobs I start with &.
I am happy with this, but other ppl online and friends say that the jobs should end when the ssh session ends??