#!/bin/bash # # This wrapper try to remove system's unmodified environment variables # and propagate user environments on the nodes. # # This script is licence under the same licence as OAR program # GNU GENERAL PUBLIC LICENSE # http://oar.imag.fr/ # # 1.0 Nicolas Capit (initial version for PATH and LD_LIBRARY_PATH) # 1.1 Patrick Begou (all the environment excepted... that could make problems!) # 1.2 Gabriel Moreau (format, small bug and licence) # HOST=$1 shift MYENV=$( env \ | grep "^[ABCDEFGHIJKLMNOPQRSTUVWXYZ]" \ | egrep -v "^USER=|^TERM=|^OAR|^SGE_|^LS_COLORS=\ |^ENV=|^BASH_ENV=|^HOSTNAME=|^LOGNAME=|^MAIL=\ |^MANPATH=|^OMPI_MCA_plm_rsh_agent=|^PWD=\ |^SHELL=|^SSH_|^SUDO_COMMAND=|^HOME=|^DISPLAY=\ |^SHLVL=" \ | sort \ | sed -e 's/^/export /; s/=/="/; s/$/"/' \ | tr [\\\n] [\;] ) exec /opt/oar/current/bin/oarsh $HOST "$MYENV $@" exit ################################################################ Documentation in Perl POD format (man perlpod) =head1 NAME oar-envsh - oarsh with env variable transmit =head1 SYNOPSIS oar-envsh node command =head1 DESCRIPTION C need to be executed inside an OAR cluster. It's a simple wrapper around C command which is a wrapper around C command! With C, almost all env variable are export in the new shell except the following: USER TERM OAR* SGE_* LS_COLORS ENV BASH_ENV HOSTNAME LOGNAME MAIL MANPATH OMPI_MCA_plm_rsh_agent PWD SHELL SSH_* SUDO_COMMAND= HOME DISPLAY SHLVL Alway use C, only use C if really needed! =head1 SEE ALSO oarsh =head1 AUTHORS Written by : Nicolas Capit, Grenoble - France Patrick Begou - Gabriel Moreau, Grenoble - France =head1 LICENSE AND COPYRIGHT GPL version 2 or later Copyright (C) 2011 Patrick Begou / LEGI - CNRS UMR 5519 - France =cut