Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using nohup to run commands in the background #106

Open
jrt324 opened this issue Jan 15, 2024 · 1 comment
Open

Using nohup to run commands in the background #106

jrt324 opened this issue Jan 15, 2024 · 1 comment
Labels

Comments

@jrt324
Copy link

jrt324 commented Jan 15, 2024

I need to execute a background program in Linux through MedallionShell, and even if the host's .net process is exited, the executed command will not be terminated. So far, this is what I have thought of is for Example:
nohup roslaunch test_launch agv.launch &
Please note that I added an '&' symbol at the end that means this command will run on background.
but this is not working , If i remove the end of '&', Then it can execute but this command Thread never end (Because it's long running processes)

I don't know the reason, or if there are any other solutions, please let me know.

The two goals I want to achieve are:

  1. Running the command line in the background, and
  2. Even if the .net Main process exits, the executed command line will not terminate.
@madelson
Copy link
Owner

@jrt324 keep in mind that MedallionShell runs processes; it isn’t a shell environment like bash. So there’s no “&” syntax because that’s shell syntax.

For a long-running process, the MedallionShell command will never finish. Therefore, you probably want to turn off stdio redirection which can be done via the start info command option. Otherwise, the host process will be capturing the downstream process’s output.

Another option for something like this is to use MedallionShell to run bash (or any shell). Then you can execute commands with bash syntax and capabilities, eg;

Command.Run(“bash”, “-c”, [“nohup … &”]);

If you can’t get it working, please post the specific code you’re trying to run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants