LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-16-2008, 03:49 PM   #1
srunni
LQ Newbie
 
Registered: Jun 2007
Posts: 24

Rep: Reputation: 15
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?

Thanks!
 
Old 07-16-2008, 04:54 PM   #2
jlarsen
Member
 
Registered: Jan 2005
Location: Dallas, TX
Distribution: Slackware 14.1
Posts: 80

Rep: Reputation: 15
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
 
Old 07-16-2008, 04:54 PM   #3
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
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).
 
Old 07-16-2008, 05:16 PM   #4
srunni
LQ Newbie
 
Registered: Jun 2007
Posts: 24

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jlarsen View Post
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 View Post
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.

Last edited by srunni; 07-16-2008 at 05:18 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Some of the output redirected to /dev/null appears on the screen while 'scripting' gregorian Linux - Newbie 27 06-23-2008 09:44 AM
What is meant by " file > /dev/null 2>&1 </dev/null " attockonian Linux - Newbie 5 06-30-2006 10:51 PM
redirecting stdout to /dev/null and stderr to stdout? Thinking Programming 1 05-18-2006 02:36 AM
C: Getting program's output MylesCLin Programming 4 02-24-2005 05:06 PM
All output to /dev/null? Satriani Programming 13 10-17-2003 01:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration