Skip to content
Prev 60986 / 398498 Next

Calling R from a non-X shell script to plot?

Seth Falcon wrote:
FWIW, here's what I've used in the past for an Xvfb init script:

8<------------------------------------
#!/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
8<-----------------------------------------

HTH,

Joe