Glam Prestige Journal

Bright entertainment trends with youth appeal.

Im trying to execute a program with xterm and then close xterm with program running but it seems this doesn't work like I would expect it.

In bash there is the option bash -c [command] is there something in xterm too? Currently im using xterm -e [command] but this keeps the xterm window open till' my program has finished. But I want to open it, run the program, close it and keep the program running.

Why i want have a program startet through xterm when im not even using it? Im calling this through xpra on another computer but its not possible to only launch the program because i need it with the environment on the other pc.

Is there a way to do it?

1

2 Answers

I don't think You need xpra. ssh is a good choice

ssh user@hostname /path/to/program

or ssh + screen

ssh user@hostname "screen /path/to/program"

or xpra + screen

xpra user@hostname "screen /path/to/program"
2

You seem to be confused about how things work. You don't need a terminal to run a program.

"Start xterm so you can start a process and then exit xterm" reduces to "start a process" and you can factor out xterm entirely.

I'm guessing you are looking for

nohup command >command.out 2>command.err &

which starts command as a background process (because of the &) with output going to command.out and error messages to command.err.

If you don't care about output or the signal handling with nohup, you might simply just want

command &

This doesn't allow you to interact with the background command (but neither does closing the xterm so I guess you don't need that); if you want to be able to do that, consider screen or tmux which lets you run the program in a virtual terminal you can disconnect from and reconnect to later.

10

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy