...
Code Block |
---|
#!/bin/bash cd odysseus.server.gtk.linux.x86 while true; do java -Xmx500M -Xms500M -Declipse.p2.mirrors=false -jar plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -console -debug -data @noDefault if [ "$?" != "23" ]; then break fi done |
For the standard Beagle board "unzip" and "java" must be installedWith the following script, you can run Odysseus at boot time (Requires 'screen'):
Code Block | ||
---|---|---|
| ||
apt-get update
apt-get install unzip
apt-get install openjdk-7-jre
// If multiple java versions are installed: choose the jdk to use. Must be at least java 7
update-alternatives --config java |
Start same as above the raspberry.
Further devices testet:
- Cubiboard 3 (Cubietrack), Image use e.g. http://www.igorpecovnik.com/2013/12/24/cubietruck-debian-wheezy-sd-card-image/
- Banana Pi (todo)
With the following script, you can run Odysseus at boot time (Requires 'screen'):
Code Block | ||
---|---|---|
| ||
#!/bin/bash # /etc/init.d/odysseus ### BEGIN INIT INFO # Provides: odysseus # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs # Should-Start: $network # Should-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Odysseus server # Description: Init script for the Odysseus ### END INIT INFO NAME=odysseus DESC="Odysseus data stream management system" USERNAME=odysseus PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME SCREENNAME=$NAME.screen DAEMON=$NAME DAEMON_PATH="/path/to/odysseus" ME=`whoami` as_user#!/bin/bash # /etc/init.d/odysseus ### BEGIN INIT INFO # Provides: odysseus # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs # Should-Start: $network # Should-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Odysseus server # Description: Init script for the Odysseus ### END INIT INFO NAME=odysseus DESC="Odysseus data stream management system" USERNAME=odysseus PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME SCREENNAME=$NAME.screen DAEMON=$NAME DAEMON_PATH="/path/to/odysseus" ME=`whoami` as_user() { if [ $ME == $USERNAME ] ; then bash -c "$1" else su $USERNAME -s /bin/bash -c "$1" fi } force_exit() { echoif "" [ echo "SIGINIT CALLED - FORCE EXITING!" rm $PIDFILE ps aux | grep -e '$DAEMON_PATH/$DAEMON' | grep -v grep | awk '{print $2}' | xargs -i kill {}$ME == $USERNAME ] ; then bash -c "$1" pselse aux | grep -e '$SCREENNAME' | grep -vsu grep$USERNAME | awk '{print $2}' | xargs -i kill {}-s /bin/bash -c "$1" fi } force_exit() { psecho aux"" | grep -e '$SCRIPTNAME' | grep -v grep | awk '{print $2}' | xargs -i kill {}echo "SIGINIT CALLED - FORCE EXITING!" rm $PIDFILE ps aux | grep exit 1 } do_command() { as_user "screen -p 0 -S $SCREENNAME -X eval 'stuff \"$1\"\015'" } do_start() { printf "%-50s" "Starting $NAME..." as_user "screen -c /dev/null -dmS $SCREENNAME $DAEMON_PATH/$DAEMON" as_user "screen -list | grep "\.$SCREENNAME" | cut -f1 -d'.' | tr -d -c 0-9 > $PIDFILE" PID=`cat $PIDFILE` if [ -z $PID ]; then printf "%s\n" "Fail" else printf "%s\n" "Ok" fi } do_stop-e '$DAEMON_PATH/$DAEMON' | grep -v grep | awk '{print $2}' | xargs -i kill {} ps aux | grep -e '$SCREENNAME' | grep -v grep | awk '{print $2}' | xargs -i kill {} ps aux | grep -e '$SCRIPTNAME' | grep -v grep | awk '{print $2}' | xargs -i kill {} exit 1 } do_command() { as_user "screen -p 0 -S $SCREENNAME -X eval 'stuff \"$1\"\015'" } do_start() { printf "%-50s" "StoppingStarting $NAME..." if [ -f $PIDFILE ]; then do_command exit sleep 0.5as_user "screen -c /dev/null -dmS $SCREENNAME $DAEMON_PATH/$DAEMON" as_user "screen -list | grep "\.$SCREENNAME" | cut -f1 -d'.' | tr -d -c 0-9 > $PIDFILE" PID=`cat $PIDFILE` as_user "rm $PIDFILE" if [ -z $PID ]; then printf "%s\n" "Ok" rm -f $PIDFILEFail" else printf "%s\n" "pidfile not foundOk" fi } do_statusstop() { printf "%-50s" "Checking $NAME..." Stopping $NAME" if [ -f $PIDFILE ]; then do_command exit sleep 0.5 if [ -f $PIDFILE ]; thenas_user "rm $PIDFILE" PID=`cat $PIDFILE` printf if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then"%s\n" "Ok" rm -f $PIDFILE else printf "%s\n" "pidfile not "Process dead but pidfile exists" else echo "Running"found" fi } do_status() { printf "%-50s" "Checking $NAME..." if [ -f $PIDFILE ]; then PID=`cat $PIDFILE` fi if [ -z else printf "%s\n" "Service not running" "`ps axf | grep ${PID} | grep -v grep`" ]; then fi } trap force_exit SIGINT case "$1" in start) printf "%s\n" "Process dead but pidfile exists" do_start else ;; echo stop)"Running" do_stopfi ;;else restart) do_stop printf "%s\n" "Service not running" do_start ;;fi } trap force_exit SIGINT case "$1" in statusstart) do_statusstart ;; commandstop) ifdo_stop [ $# -gt 1 ];; then shift do_command "$*" restart) elsedo_stop do_start echo "Must specify command (try 'help'?)" ;; status) fido_status ;; *command) echo "Usage: $0 {start|stop|status|restart|command \"command\"}" exit 1 ;; esac exit 0 |
To add the init script to the default run levels issue the following command:
Code Block | ||
---|---|---|
| ||
update-rc.d odysseus defaults |
For the standard Beagle board "unzip" and "java" must be installed:
Code Block | ||
---|---|---|
| ||
apt-get update
apt-get install unzip
apt-get install openjdk-7-jre
// If multiple java versions are installed: choose the jdk to use. Must be at least java 7
update-alternatives --config java |
Start same as above the raspberry.
Further devices testet:
...
if [ $# -gt 1 ]; then
shift
do_command "$*"
else
echo "Must specify command (try 'help'?)"
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart|command \"command\"}"
exit 1
;;
esac
exit 0 |
To add the init script to the default run levels issue the following command:
Code Block | ||
---|---|---|
| ||
update-rc.d odysseus defaults |
...