Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Ubuntu SSH behavior
PostPosted: Tue Dec 10, 2013 4:33 am 
Offline
Newbie

Joined: Fri Dec 06, 2013 12:10 pm
Posts: 4
Hi Chaps,

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 root@xxx.xxx.xxx.xxx

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?


Top
   
 Post subject: Re: Ubuntu SSH behavior
PostPosted: Tue Dec 10, 2013 4:37 am 
Offline
Sysop

Joined: Sat Nov 27, 2010 3:32 am
Posts: 180
Website: https://blog.timheckman.net/
Location: San Francisco, CA
What does kicking off the scripts mean? How do you do it?

-Tim

_________________
'If debugging is the process of removing bugs, then programming must be the process of putting them in.' //Edsger Dijkstra
'Nothing is withheld from us which we have conceived to do.' | 'Do things that have never been done.' //Russell Kirsch


Top
   
 Post subject: Re: Ubuntu SSH behavior
PostPosted: Tue Dec 10, 2013 7:29 am 
Offline
Newbie

Joined: Fri Dec 06, 2013 12:10 pm
Posts: 4
Hi my friend,

I literally just type "php script.php&"

at the prompt.

Here is one of the scripts:

http://tny.cz/52b68ead


Top
   
 Post subject: Re: Ubuntu SSH behavior
PostPosted: Tue Dec 10, 2013 2:46 pm 
Offline
Sysop

Joined: Sat Nov 27, 2010 3:32 am
Posts: 180
Website: https://blog.timheckman.net/
Location: San Francisco, CA
For my own curiosity, do you know what the ampersand does?

-Tim

_________________
'If debugging is the process of removing bugs, then programming must be the process of putting them in.' //Edsger Dijkstra
'Nothing is withheld from us which we have conceived to do.' | 'Do things that have never been done.' //Russell Kirsch


Top
   
 Post subject: Re: Ubuntu SSH behavior
PostPosted: Tue Dec 10, 2013 7:08 pm 
Offline
Senior Member

Joined: Wed Oct 20, 2010 12:11 pm
Posts: 142
No fair looking at the source code you posted!


Top
   
 Post subject: Re: Ubuntu SSH behavior
PostPosted: Wed Dec 11, 2013 7:18 am 
Offline
Newbie

Joined: Fri Dec 06, 2013 12:10 pm
Posts: 4
@theckman, Yes, it makes the job in the background right? same as doing a ctrl-Z and bg.

It can be brought to foreground by fg, that's it right?


@derfy, What do you mean no fair? :D



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??

Thanks again


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group