Joe Conway wrote:
Dirk Eddelbuettel wrote:
On Fri, Jan 21, 2005 at 06:06:45PM -0800, Leah Barrera wrote:
I am trying to plot in R from a perl script using the Statistics::R
package as my bridge. The following are the conditions:
0. I am running from a Linux server.
Plotting certain formats requires the X11 server to be present as the
font metrics for those formats can be supplied only the X11 server.
Other drivers don;t the font metrics from X11 -- I think pdf is a
good counterexample. When you run in 'batch' via a Perl script, you
don't have the X11 server -- even though it may be on the machine and
running, it is not associated with the particular session running
your Perl job. There are two common fixes:
a) if you must have png() as a format, you can start a virtual X11
server with the xvfb server -- this is a bit involved, but doable;
Attached is an init script I use to start up xvfb on Linux.
HTH,
Joe
------------------------------------------------------------------------
#!/bin/bash
#
# syslog Starts Xvfb.
#
#
# chkconfig: 2345 12 88
# description: Xvfb is a facility that applications requiring an X frame buffer
\
# can use in place of actually running X on the server
# Source function library.
. /etc/init.d/functions
[ -f /usr/X11R6/bin/Xvfb ] || exit 0
XVFB="/usr/X11R6/bin/Xvfb :5 -screen 0 1024x768x16"
RETVAL=0
umask 077
start() {
echo -n $"Starting Xvfb: "
$XVFB&
RETVAL=$?
echo_success
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/Xvfb
return $RETVAL
}
stop() {
echo -n $"Shutting down Xvfb: "
killproc Xvfb
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/Xvfb
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/Xvfb ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart}"
exit 1
esac
exit $RETVAL
Hmm, the only problem with that is that, if I am not mistaken, you are
starting Xvfb without any authentication, and I am told by people who
know about such things that in the context of an Internet-accessible Web
server, having an X server accepting unauthenticated connections is not
a good idea. In other, less hostile environments, it might be OK. Maybe
such concerns are unreasonable paranoia, but my motto is better safe
than sorry when it comes to Internet-facing servers. I think there are
also other switches you can pass to Xvfb to stop it listening on various
TCP/IP ports etc.
Tim C
______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html