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?
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?
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.
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.