Selenium on Synology
I recently bought a Synology nas for my business and found it to be a highly capable box. It’s become so useful that it’s quickly becoming the backbone of the business, supplying services like shared drives, hosted web services (databases, websites, etc), VPN, and network backups. Having the ability to host dynamic websites, the server is also able to run Selenium Server in the background after a few mods, enabling it to be used as a QA box for functional testing done at my company. Here’s what you have to do:
- Bootstrap the nas if you haven’t already done so.
- Use ipkg to install jamvm. This will install all the dependencies also (classpath, zlib, file).
- (optional) Create a symbolic link for personal preferences: “ln -s /opt/bin/jamvm /opt/bin/java”
- Download selenium server package. I placed mine in /opt/share/selenium/.
- Create a startup script. You can modify it according to your needs. Here is mine (named S82selenium):
#!/bin/sh
#Location of selenium jar file
SELENIUM=/opt/share/selenium/selenium-server-standalone-2.0.0.jar
DESC="Selenium Server"
NAME=S82selenium
LOG=/var/log/selenium.log
PIDFILE=/var/run/selenium.pid
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
if [ -e $PIDFILE ] ; then
echo "error: $DESC already running (`cat $PIDFILE`)."
exit
fi
/opt/bin/java -jar $SELENIUM >>$LOG 2>&1 &
pid=$!
echo $pid > $PIDFILE
echo "done."
;;
stop)
echo -n "Stopping $DESC: "
if [ -e $PIDFILE ] ; then
kill `cat $PIDFILE`
rm $PIDFILE
echo "done."
else
echo "error: $DESC is not running."
fi
;;
restart|force-reload)
echo -n "Restarting $DESC: "
$0 stop
sleep 1
$0 start
echo "done."
;;
status)
echo -n "$DESC status: "
if [ -e $PIDFILE ] ; then
echo "started (`cat $PIDFILE`)"
else
echo "stopped"
fi
;;
*)
N=/opt/etc/init.d/$NAME
echo "Usage: $N (start|stop|restart|force-reload)" >&2
exit 1
;;
esac
exit 0
-
Make the script executable: chmod +x S82selenium
-
Test to see if everything’s okay: ./S82selenium start.
-
Congratulations! Now you have a Selenium Server running automatically on your Synology nas.