Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#210133 - 23/03/2004 06:33 Background programs in Linux
andyb
new poster

Registered: 30/10/2001
Posts: 21
Loc: Oxfordshire
I have a little program that runs under Red Hat 9, i want to start it then log off and for it to continue running. Is there a special command to do this? With all the expertise on this forum i thought this would be an easy question for someone. (i was told placing an ampersand at the end of the command line would do this. But it made the program unusable, and ate 90%+ of the machines cpu power)
Thanks, andy.

Top
#210134 - 23/03/2004 07:54 Re: Background programs in Linux [Re: andyb]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5682
Loc: London, UK
You want to look at nohup. Or screen, which is way cool.
_________________________
-- roger

Top
#210135 - 23/03/2004 09:27 Re: Background programs in Linux [Re: Roger]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Well, nohup is the obvious answer to that question, but he seems to be going another way. (My favorite shell, zsh, also has a modified background indicator, &! that does the same thing with less fuss.)

Why does the program become unusable? We can tackle the 90% CPU utilization later.

I have the feeling that the answer to this is going to be screen, though.
_________________________
Bitt Faulk

Top
#210136 - 23/03/2004 09:37 Re: Background programs in Linux [Re: wfaulk]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4174
Loc: Cambridge, England
Why does the program become unusable? We can tackle the 90% CPU utilization later.
Sounds like the program gets confused if its input isn't a tty, or perhaps even if it gets EOF on stdin (text mode freeamp, for instance, used to have this bug). If that's the case, nohup won't solve the problem but screen will.

Peter

Top
#210137 - 23/03/2004 10:09 Re: Background programs in Linux [Re: wfaulk]
andyb
new poster

Registered: 30/10/2001
Posts: 21
Loc: Oxfordshire
The program uses Ada Web Server to provide a web interface to a program which works with MySQL. When i log off, the 'log in' page continues to be hosted, so the web server is still active, but when you type anything in it just hangs.

I have looked at the nohup command and i will try it soon (have to get myself to the machine first).

Screen looks interesting, only problem is that its more software to install, and i wanted to keep the number of pieces of software to a minimum. The machine I am using for development, may not be the one it will run on (may not even be the same architecture). I will certainly get it installed if it's the only way to solve this problem.

While I am at the machine I will see the processor usage during normal operation. it had better not be running at that permanently!

Thanks for your advice

I'll see what nohup does and tell you all.

Top
#210138 - 23/03/2004 10:29 Re: Background programs in Linux [Re: andyb]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Not that I know that it's the right solution (even if it is almost certainly a solution), but screen is not a heavyweight application at all. I mean, it's bigger than nohup, but it's about the same weight as a powerful shell, and I don't think it depends on much beyond term{cap/info} and curses, if that.


Edited by wfaulk (23/03/2004 10:33)
_________________________
Bitt Faulk

Top
#210139 - 23/03/2004 10:45 Re: Background programs in Linux [Re: wfaulk]
cmtempeg
journeyman

Registered: 29/07/2003
Posts: 66
Loc: Minneapolis, Minnesota, USA
screen good.

---
NAPSTER BAD!
_________________________
Hello, my name is Bingo. I like to climb on things. Can I have a banana? eek eek.

Top
#210140 - 23/03/2004 11:27 Re: Background programs in Linux [Re: peter]
andyb
new poster

Registered: 30/10/2001
Posts: 21
Loc: Oxfordshire
nohup is no help. Everything stops as soon as i log off. It's still there and using power, but it won't answer requests for pages, or generate any pages for me. Worth a shot thought, thanks for suggesting it.

Still not sure why it suddenly decides it wants so much power, before i log off it is using a couple of percent max (I think). Hopefully it's just linked to what's happening and screen will stop it.

screen is the way to go it seems.

Top
#210141 - 23/03/2004 11:30 Re: Background programs in Linux [Re: andyb]
RobotCaleb
pooh-bah

Registered: 15/01/2002
Posts: 1866
Loc: Austin
screen and nice
i believe nice will drop your cpu usage on it. someone more savvy than myself should probably explain more
ive only used nice for compiling stats pages from counter-strike logs. it would make the program not take up all of the cpu time, leaving the cpu free to be used for the serving of the game

Top
#210142 - 23/03/2004 11:33 Re: Background programs in Linux [Re: andyb]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Chances are that for some reason it needs a tty and once the terminal's gone, it thrashes around looking for one, pegging the CPU in the process. Not exactly the most robust application. If it's open source, submit a bug or fix it. If it's commercial, yell at your vendor.

You wouldn't believe the effot I had to go to to get Sybase's EAServer application server to run under Solaris as a daemon. What they want you to do is log into a X session and run the application, which spawns a new xterm and keeps its "console" there, even though it's output only. They were uninterested in fixing the problem.
_________________________
Bitt Faulk

Top
#210143 - 23/03/2004 11:45 Re: Background programs in Linux [Re: wfaulk]
andyb
new poster

Registered: 30/10/2001
Posts: 21
Loc: Oxfordshire
I shall submit the problem to the developers and other users. The web server is open source, and in my opinion damn good. Ada isn't the language of choice for this kind of thing, and something like PHP would be the standard way, but this is a little different.
If one of the other users can't answer then screen it will be. You may be thinking 'why did he post here, and not direct to other users of the web server?' becasue i thought it would be a Liunx command i was after and not necessarily specific to the web server. Therefore there always appears to be knowledgable people here and i though i would Everything i have done with it has been a learning experience, this continues it. I really appreciate the input.

Top
#210144 - 23/03/2004 12:04 Re: Background programs in Linux [Re: RobotCaleb]
cmtempeg
journeyman

Registered: 29/07/2003
Posts: 66
Loc: Minneapolis, Minnesota, USA
Close.
nice sets the priority of the process that it is running. That is, it can still take all the available CPU (if it needs it), but other applications are more likely to get dibs first.

Also, see renice.
_________________________
Hello, my name is Bingo. I like to climb on things. Can I have a banana? eek eek.

Top