We recommend to use the docker version of Odysseus. See Run with Docker.
This page describes how to install Odysseus Server as a Linux service that starts at system start automatically.
First, you have to install all dependencies as described at How to install Odysseus. Save the Odysseus Server binaries to a proper location, e. g., to /opt/odysseus/. Then, you should create a script that starts odysseus, e. g. to /usr/local/bin/odysseus. Example for this script:
#!/bin/sh while true; do java -Xmx500M -Xms500M -Declipse.p2.mirrors=false -jar /opt/odysseus/plugins/org.eclipse.equinox.launcher_1.5.500.v20190715-1310.jar -console -debug -data @noDefault if [ "$?" != "23" ]; then break fi done
Don't forget to make it executable:
chmod +x /usr/local/bin/odysseus
Now, you can use the command odysseus to start the Odysseus Server (because /usr/local/bin is in the path variable).
To let Odysseus start at system start, you have to add a start script at /etc/init.rc/odysseus. The following simple example expects a user odysseus:
#! /bin/sh
### BEGIN INIT INFO
# Provides: odysseus
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop Odysseus Server
### END INIT INFO
USERNAME=odysseus
do_start() {
# TODO: prevent starting odysseus a bunch of times
su $USERNAME -l -c "screen -dmS odysseus odysseus"
}
do_stop() {
# TODO: if you have started odysseus a bunch of times without stopping it before, stopping doesn't work
su $USERNAME -c "screen -p 0 -S odysseus -X quit"
}
case "$1" in
start)
echo "Starting Odysseus ..."
do_start
;;
stop)
echo "Stopping Odysseus ..."
do_stop
;;
restart)
echo "Restarting Odysseus ..."
do_stop
do_start
;;
*)
echo "Usage: /etc/init.d/odysseus {start|stop}"
;;
esac
exit 0
On most Linux distributions, you can activate this script by (as root):
update-rc.d odysseus defaults
You can start, stop or restart the Odysseus service by (as root):
/etc/init.rc/odysseus start /etc/init.rc/odysseus stop /etc/init.rc/odysseus restart # On most systems also: service odysseus start service odysseus stop service odysseus restart
You can get the OSGI console by joining the screen instance:
# as user odysseus: screen -S odysseus -dRR # if you get a error message like 'Cannot open your terminal '/dev/pts/1' - please check.' you have to use the following command: script -q -c "screen -S odysseus -dRR" /dev/null # As root, you can use the following command: su odysseus -l -c "script -q -c \"screen -S odysseus -dRR\" /dev/null"
To leave the OSGI console, you have to press Ctrl+A followed by the key d.
To deploy odysseus to a bunch of servers, you can use a deploy script.