strange behavior of my application

Linux specific forum
Flastick
New User
New User
Posts: 6
Joined: Mon Feb 11, 2008 11:53 pm

strange behavior of my application

Post by Flastick »

Hi all !
I tested my program on kubuntu and it worked great and now I would like to run it on debian (sarge ) by ssh (remote access).

so I launch it tiping root> ./myprogram (this is not a graphical application) and then I can tip anything ..nothing happens ..it's like it makes everything freeze. But the program is working great! And if I close the ssh console, the program just ends..why??

here is how looks my callback :

Repeat
SEvent = NetworkServerEvent()

If SEvent
....
....
EndIf

Delay(5)

ForEver


Is anything wrong with the way I launch it? or the way I made my callback ?


Thanks in advance for your help !! :-)
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

starting an app from a console makes the console wait for the end of the programm... unless you use the & (ampersand) behind the app..
i.e. myprompt>./mypgm &
then the app is started in the background while the console still replies... though output of your pgm is still directed to this console (unless you redirect it)
Flastick
New User
New User
Posts: 6
Joined: Mon Feb 11, 2008 11:53 pm

Post by Flastick »

Thank you for your answer ! I just didn't understand your last sentence : " though output of your pgm is still directed to this console (unless you redirect it)" Does it mean that if I quit the console all the programs wich have been executed from this console will end ? And where can I redirect it? to another console? Sorry I'm a new linux user.. !
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

start your program with an ampersand as "parameter"
i.e bash>myprog &

then you can close the console using the exit command (do NOT close the console with the close-button of the systemmenu) and your pgm is still running...

if you do not use the & .. the started prog will be terminated if you close the console (and without the & you can only use the close-button....)

with > and >> you can redirect the output of your pgm to a file

bash> myprog >mylog.txt &
will create a file mylog.txt and the output is redirected into this file

bash> myprog >>mylog.txt &
will append the output to a file called mylog.txt and only if it does not exist, it will be created

there also exists a pipe | which will redirect the output of pgm1 as input for pgm2

bash> myprog1 | myprog2 &

a conditional Pipe && which will start end execute the second pgm if the first one returns true

bash> myprog1 && myprog2 &

there are some more constellations I don't remember at the moment...
Flastick
New User
New User
Posts: 6
Joined: Mon Feb 11, 2008 11:53 pm

Post by Flastick »

Oh okay ! Now I understood everything.
Thank you ! I'll try this right now ! :-)
Post Reply