Skip to content
Snippets Groups Projects
Commit c1dc63ad authored by Daniel Peppicelli's avatar Daniel Peppicelli
Browse files

[NRRPLT-2780] Moved gzbridge script out of the nfs4 module

Change-Id: Iaf334d440644feefa222f1f63f8896fef9acd9af
parent ed9761f5
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
#
# gzbridge Communication bridge for accessing Gazebo via the web
#
# chkconfig: 2345 20 80
# description: Handles the gzbridge component which bridges the communication \
# between Gazebo (protobuf) and the web (JSON)
### BEGIN INIT INFO
# Provides: gzbridge
# Required-Start: $remote_fs gzserver
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop gzbridge
# Description: gzbridge is the communication bridge for the Gazebo robot simulator.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
DOMAIN=`hostname -d`
case $DOMAIN in
'epfl.ch')
export MODULEPATH=$MODULEPATH:/nfs4/bbp.epfl.ch/sw/neurorobotics/modulefiles
export MODULEPATH=$MODULEPATH:/nfs4/bbp.epfl.ch/sw/module/modulefiles
source /nfs4/bbp.epfl.ch/sw/platform/set_module_path.sh
module load boost/1.55zlib-rhel6-x86_64-gcc4.4
module load sdf/2.0-rhel6-x86_64-gcc4.4
module load gazebo/4.0-rhel6-x86_64-gcc4.8.2
module load ogre/1.8.1-rhel6-x86_64-gcc4.8.2
export GZBRIDGE_BIN_DIR=/nfs4/bbp.epfl.ch/sw/neurorobotics/gzweb/2014.10.15/rhel-6.5-x86_64/gcc-4.8.2/x86_64/gzweb/gzbridge
;;
'cscs.ch')
export MODULEPATH=$MODULEPATH:/gpfs/bbp.cscs.ch/apps/viz/neurorobotics/modulefiles
source /gpfs/bbp.cscs.ch/apps/viz/set_module_path.sh
module load boost/1.55zlib-rhel6-x86_64-gcc4.4
module load sdf/last-build
module load gazebo/last-build
module load gzbridge/last-build
module load ogre/1.9.0-rhel6-x86_64-gcc-4.8.2
;;
*)
#see if we found a valid path above, could make this exit if we wanted
echo "Warning: no valid set_module_path.sh, do you have access to /nfs4 or /gpfs?"
exit -1
;;
esac
if [ -z $GZBRIDGE_BIN_DIR ]; then
echo "Necessary environment variable GZBRIDGE_BIN_DIR not set!"
exit 1
fi
exec="$GZBRIDGE_BIN_DIR/ws_server.js"
prog="node"
lockfile=/home/$USER/lock/$prog
start() {
echo -n $"Starting $prog: "
# test if the exec file exists and execute permission is granted
# exit with exit code 5 (program not installed) if conditions do not hold
[ -x $exec ] || exit 5
# we have to change to the directory, otherwise loading of materials
# does not work properly :(
cd $GZBRIDGE_BIN_DIR
# if not running, start gzbridge up here
$exec &>/dev/null &
retval=$?
if [ $retval -eq 0 ]; then
echo_success
fi
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
# stop gzserver here with the help of the killproc function
killproc $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
# run checks to determine if the service is running or use generic status
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?
...@@ -14,7 +14,7 @@ set sw_basedir "$NEUROROBOTICS_MODULE_PATH" ...@@ -14,7 +14,7 @@ set sw_basedir "$NEUROROBOTICS_MODULE_PATH"
set package_name "$BUILD_PACKAGE_NAME" set package_name "$BUILD_PACKAGE_NAME"
set version "$BUILD_VERSION" set version "$BUILD_VERSION"
set platform "rhel6" set platform "rhel6"
set compiler "$BUILD_COMPILER " set compiler "$BUILD_COMPILER"
set architecture "x86_64" set architecture "x86_64"
set root "$sw_basedir/$package_name/$version/$platform/$compiler/$architecture/" set root "$sw_basedir/$package_name/$version/$platform/$compiler/$architecture/"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment