Redirecting a desktop-oriented program's mandatory X output to /dev/null for a server
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Redirecting a desktop-oriented program's mandatory X output to /dev/null for a server
Hi,
I'm trying to write a script that automates some graphical software, such that you can run one command, and it will do its job and quit. But the program requires a graphical environment for it to output to for this script to function, even though the script never requires any interaction. This script will generally be used on a server, where a graphical environment is not available to output to. Is there a way I can redirect X's output to /dev/null or something, so that the program thinks that I have a graphical environment to output to, when it actually doesn't?
What program are you trying to interface with? It is pretty rare for a Linux program to require a graphical environment (unless it is something that depends on a GUI to function, like GIMP, but that doesn't seem like the case here).
I'm guessing here, but have you tried something similar to this:
Code:
#!/bin/bash
# small script to start your program
export DISPLAY=/dev/null
/path/to/program
exit
I tried that, but I get this error:
Code:
xterm Xt error: Can't open display: /dev/null
I know the problem is occurring when the program is running, because it doesn't produce any errors when I launch it in the script with a flag to disable the GUI (a flag I cannot use if I want to access the functionality I need).
Quote:
Originally Posted by MS3FGX
What program are you trying to interface with? It is pretty rare for a Linux program to require a graphical environment (unless it is something that depends on a GUI to function, like GIMP, but that doesn't seem like the case here).
VMD. It is possible to run it without a GUI, but the particular functionality I want is not available unless a GUI is running.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.