0

I want to run a program in background and then run another program which is dependent to former one. I'm on Arch-Linux latest version, No gui and I cannot run multiple terminals. If I run this code :

sleep 20 &

it works and terminal gets free to write another command. but when I run my own command like

./Sender.exe

which is a tcp listener console application wrote in c# , it wont free terminal and I need to press enter to get out. In this way application gets stopped.

[1]+     stopped        ./Sender.exe

If I write my command like this:

./Sender.exe & command2

second command should run after a sec because /sender.exe needs some time to start to listening on a port, and command2 fails to run.

What should I do? Thanks

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
mahdi gh
  • 438
  • 1
  • 7
  • 18
  • 1
    You'll want your program to daemonize itself after it's finished initializing. Daemonization turns it into a background process and returns control to the shell. See the linked question for details. – John Kugelman Sep 18 '17 at 10:36
  • Assuming Sender.exe is not doing anything weird with process groups, the problem is probably that it's either trying to read its `stdin` (if a background process does that and `stdin` is the controlling terminal, the background process gets put to sleep) or it's trying to write to the terminal and you're terminal is set to stop background processes that try to do that (the `-tostop` terminal option is on). – Petr Skocik Sep 18 '17 at 10:37

0 Answers0