tags:

views:

730

answers:

2

I tried to run a programme in background mode and foreground mode,

while in background mode,it failed to run,

but in foreground mode,it succeeded,

so what's the difference between background and foreground mode that might cause this issue?

+1  A: 

Background processes typically run with little or no user interaction, they interact with the system instead. Forground processes are what the user interacts with. Background processes, unless explicitly ran so, run with non-admin permissions. If you ran it under your user-context, then it would likely have the permissions to do whatever it is the app does.

Wayne Hartman
maybe some more information is needed.here are those running in background mode:root 30495 1 0 06:58 pts/0 00:00:02 php start.php bots/admin41.bot.phproot 5025 29551 0 08:48 pts/0 00:00:00 php start.php bots/admin4.bot.php
Shore
+2  A: 

A foreground process has access to the terminal (standard input and output).

You can try to fix the issue by adding <> /dev/null to the commandline. This will tell the program not to use stdin. Some programs take this into accound and "behave" as soon as you don't give them a terminal anymore.

Another solution is the nohup program which does basically the same plus some more things.

Aaron Digulla