2009-02-05 09:05:28 +03:00
|
|
|
#! /bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (c) 2009 Los Alamos National Security, LLC. All rights reserved
|
|
|
|
#
|
|
|
|
|
|
|
|
if (( $# < 1 )) ; then
|
|
|
|
echo "orte-bootproxy.sh: for OMPI internal use only"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# take the first arg
|
|
|
|
var=$1
|
|
|
|
|
2009-04-29 04:11:19 +04:00
|
|
|
# if the var is CLEANUP, then we are in cleanup mode
|
|
|
|
if [ "${var}" == "CLEANUP" ]; then
|
|
|
|
shift 1
|
|
|
|
var=$1
|
|
|
|
if [ -n "${var}" ] && [ "${var}" == "APPS" ]; then
|
|
|
|
# kill specified apps
|
|
|
|
shift 1
|
|
|
|
var=$1
|
|
|
|
while [ -n "${var}" ] && [ "${var}" != "FILES" ]; do
|
|
|
|
killall -TERM "${var}"
|
|
|
|
# echo "killall" "${var}"
|
|
|
|
shift 1
|
|
|
|
var=$1
|
|
|
|
done
|
|
|
|
if [ -n "${var}" ]; then
|
|
|
|
shift 1
|
|
|
|
var=$1
|
|
|
|
# remove specified files
|
|
|
|
while [ -n "${var}" ]; do
|
|
|
|
rm -f "${var}"
|
|
|
|
# echo "rm" "${var}"
|
|
|
|
shift 1
|
|
|
|
var=$1
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
elif [ "${var}" = "FILES" ]; then
|
|
|
|
# remove specified files
|
|
|
|
shift 1
|
|
|
|
var=$1
|
|
|
|
while [ -n "${var}" ]; do
|
|
|
|
rm -f "${var}"
|
|
|
|
# echo "rm" "${var}"
|
|
|
|
shift 1
|
|
|
|
var=$1
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
# remove any session directories from this user
|
2009-04-29 18:37:33 +04:00
|
|
|
# sdir="${TMPDIR}""openmpi-sessions-""${USER}""@"`hostname`"_0"
|
2009-04-29 04:11:19 +04:00
|
|
|
# echo "rm" "${sdir}"
|
2009-04-29 18:37:33 +04:00
|
|
|
sdir="/tmp/openmpi-sessions-""${USER}""@"`hostname`"_0
|
2009-04-29 04:11:19 +04:00
|
|
|
rm -rf "${sdir}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2009-02-05 09:05:28 +03:00
|
|
|
# push all MCA params to the environment
|
|
|
|
while [ "${var:0:5}" = "OMPI_" ]; do
|
2009-04-15 00:05:51 +04:00
|
|
|
if [ "${var:5:6}" = "PREFIX" ]; then
|
2009-02-10 21:27:52 +03:00
|
|
|
export LD_LIBRARY_PATH="${var:12}"/lib:$LD_LIBRARY_PATH
|
|
|
|
export PATH="${var:12}"/bin:$PATH
|
2009-04-15 00:05:51 +04:00
|
|
|
elif [ "${var:5:4}" = "WDIR" ]; then
|
|
|
|
cd "${var:10}"
|
2009-02-09 23:44:44 +03:00
|
|
|
else
|
|
|
|
export $var
|
|
|
|
fi
|
2009-04-15 00:05:51 +04:00
|
|
|
shift 1
|
|
|
|
var=$1
|
2009-02-05 09:05:28 +03:00
|
|
|
done
|
|
|
|
|
|
|
|
# extract the application to be executed
|
|
|
|
app=$1
|
|
|
|
shift 1
|
|
|
|
|
|
|
|
#exec the app with the remaining args
|
|
|
|
exec "$app" "$@"
|