| 1 | #!/bin/bash |
|---|
| 2 | # |
|---|
| 3 | # This wrapper try to remove system's unmodified environment variables |
|---|
| 4 | # and propagate user environments on the nodes. |
|---|
| 5 | # |
|---|
| 6 | # This script is licence under the same licence as OAR program |
|---|
| 7 | # GNU GENERAL PUBLIC LICENSE |
|---|
| 8 | # http://oar.imag.fr/ |
|---|
| 9 | # |
|---|
| 10 | # 1.0 Nicolas Capit (initial version for PATH and LD_LIBRARY_PATH) |
|---|
| 11 | # 1.1 Patrick Begou (all the environment excepted... that could make problems!) |
|---|
| 12 | # 1.2 Gabriel Moreau (format, small bug and licence) |
|---|
| 13 | # |
|---|
| 14 | |
|---|
| 15 | HOST=$1 |
|---|
| 16 | shift |
|---|
| 17 | |
|---|
| 18 | MYENV=$( env \ |
|---|
| 19 | | grep "^[ABCDEFGHIJKLMNOPQRSTUVWXYZ]" \ |
|---|
| 20 | | egrep -v "^USER=|^TERM=|^OAR|^SGE_|^LS_COLORS=\ |
|---|
| 21 | |^ENV=|^BASH_ENV=|^HOSTNAME=|^LOGNAME=|^MAIL=\ |
|---|
| 22 | |^MANPATH=|^OMPI_MCA_plm_rsh_agent=|^PWD=\ |
|---|
| 23 | |^SHELL=|^SSH_|^SUDO_COMMAND=|^HOME=|^DISPLAY=\ |
|---|
| 24 | |^SHLVL=" \ |
|---|
| 25 | | sort \ |
|---|
| 26 | | sed -e 's/^/export /; s/=/="/; s/$/"/' \ |
|---|
| 27 | | tr [\\\n] [\;] ) |
|---|
| 28 | |
|---|
| 29 | exec /opt/oar/current/bin/oarsh $HOST "$MYENV $@" |
|---|
| 30 | |
|---|
| 31 | exit |
|---|
| 32 | |
|---|
| 33 | ################################################################ |
|---|
| 34 | |
|---|
| 35 | Documentation in Perl POD format (man perlpod) |
|---|
| 36 | |
|---|
| 37 | =head1 NAME |
|---|
| 38 | |
|---|
| 39 | oar-envsh - oarsh with env variable transmit |
|---|
| 40 | |
|---|
| 41 | =head1 SYNOPSIS |
|---|
| 42 | |
|---|
| 43 | oar-envsh node command |
|---|
| 44 | |
|---|
| 45 | =head1 DESCRIPTION |
|---|
| 46 | |
|---|
| 47 | C<oar-envsh> need to be executed inside an OAR cluster. |
|---|
| 48 | It's a simple wrapper around C<oarsh> command |
|---|
| 49 | which is a wrapper around C<ssh> command! |
|---|
| 50 | |
|---|
| 51 | With C<oar-envsh>, almost all env variable are export |
|---|
| 52 | in the new shell except the following: |
|---|
| 53 | |
|---|
| 54 | USER TERM OAR* SGE_* LS_COLORS |
|---|
| 55 | ENV BASH_ENV HOSTNAME LOGNAME MAIL |
|---|
| 56 | MANPATH OMPI_MCA_plm_rsh_agent PWD |
|---|
| 57 | SHELL SSH_* SUDO_COMMAND= HOME DISPLAY |
|---|
| 58 | SHLVL |
|---|
| 59 | |
|---|
| 60 | Alway use C<oarsh>, |
|---|
| 61 | only use C<oar-envsh> if really needed! |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | =head1 SEE ALSO |
|---|
| 65 | |
|---|
| 66 | oarsh |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | =head1 AUTHORS |
|---|
| 70 | |
|---|
| 71 | Written by : |
|---|
| 72 | |
|---|
| 73 | Nicolas Capit, Grenoble - France |
|---|
| 74 | Patrick Begou - Gabriel Moreau, Grenoble - France |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | =head1 LICENSE AND COPYRIGHT |
|---|
| 78 | |
|---|
| 79 | GPL version 2 or later |
|---|
| 80 | |
|---|
| 81 | Copyright (C) 2011 Patrick Begou / LEGI - CNRS UMR 5519 - France |
|---|
| 82 | |
|---|
| 83 | =cut |
|---|