Skip to content

Instantly share code, notes, and snippets.

@lujiacn
Created March 18, 2015 05:35
Show Gist options
  • Save lujiacn/f445599f9a31607f7749 to your computer and use it in GitHub Desktop.
Save lujiacn/f445599f9a31607f7749 to your computer and use it in GitHub Desktop.
= Few steps to enable Rserve daemon at startup of your Linux server =
# install [R] (tested with 2.9)
# install Rserve as user:
# create `Rserve.sh` startup script in `/home/user/R/x86_64-pc-linux-gnu-library/2.9/Rserve`:
{{{
#!/bin/bash
/usr/bin/R CMD Rserve --vanilla
}}}
# check that `Rserve.sh` is executable, try to launch it and verify Rserve is available (`ps -u user | grep Rserve` should return something, then kill Rserve)
# create as root `/etc/init.d/Rserved`
{{{
#!/bin/sh
echo " * Launching Rserve daemon ..."
RSERVE_HOME=/home/user/R/x86_64-pc-linux-gnu-library/2.9/Rserve
start-stop-daemon --start --chdir $RSERVE_HOME --chuid user --exec $RSERVE_HOME/Rserve.sh > /tmp/Rserve.log 2>&1 &
echo " * Rserve daemon running ..."
exit 0
}}}
# check that `Rserved` is executable, try to launch it and verify Rserve is available (`ps -u user | grep Rserve` should return something, then kill Rserve)
# link Rserved in rc2.d (for ubuntu, maybe other rc*.d for others linux distribution): as root `cd /etc/rc2.d; ln -s ../init.d/Rserved S99Rserved`
# reboot your server to verify Rserve was correclty launched at startup.
Now, you can use this linux server as a backend computing engine for your Java applications on desktop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment