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