Want a program running after logout

Hi.
I'm a user on a Linux machine. When I want to use the
machine, I have to log on and when I'm done I logout.
This is probably a question I could have asked on the Unix
panel also, BTW.

Now, here's my problem: I'd like to have a program running
in the background of the machine AFTER I have logged out.
More precisely, this program would listen on a socket and reply
to some queries.
How does that work?
I guess that there should be a method to do that but I have
not found any information about it.

Do I need to have root access to get that working?

Thanks for help.
Gaggio
LVL 1
gaggioAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

adam923Commented:
with most programs you should be able to run them from a command prompt with a & at the end of the line to run in the background.  Once it starts running the shell will give you a number that's the "process id".  You can then log out if you'd like and the program will terminate whenever its done, or if you've programmed it to run forever just kill it with the kill command followed by the process id number.
0
ozoCommented:
man nohup
0
gaggioAuthor Commented:
adam, what you said does not work.
I have a test program that is just a infinite loop.
When I start it and then logout it is killed automatically.
I'd like something that is still running when I log back in!
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

gaggioAuthor Commented:
ozo, nohup is probably the right command to use, but
it does not work: when I log on to a Linux machine at
my university, run the program "nohupped", logout and
log back in, the program is not in the process list anymore.

The man/info pages for nohup are read pretty quick: there
are only two options.

Any hint?
Is there another way?
0
adam923Commented:
use ps u instead of ps to view the process list
0
adam923Commented:
From the man page... this is why my suggestion worked for me, maybe you aren't using csh? also, i tried this on solaris, not linux

 The C-shell ( csh(1)) has a  built-in  command  nohup   that
     provides  immunity from SIGHUP, but does not redirect output
     to nohup.out. Commands executed with `&'  are  automatically
     immune to HUP signals while in the background.              
0
gaggioAuthor Commented:
Ok adam, you are right: if I use ps -u mylogin I actually
still have the process running in the background, when
I simply use the '&' at the end of the line.

Hmmm, I knew about & but I didn't know that it was keeping
the prog running even if you logout!

Ok, so, before giving away the points (and to be fair to
Ozo), here is what will determine the winner:

What is the difference between '&' and nohup?


0
adam923Commented:
see the manpage except i put above... commands that are executed using the & don't respond to the HUP signal but don't have terminal redirection like "nohup" provides... for what you're trying to do there's really no difference.  
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gaggioAuthor Commented:
Thanks adam
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.