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 | # 1.3 Gabriel Moreau (add initial support for ulimit) |
---|
14 | # |
---|
15 | |
---|
16 | HOST=$1 |
---|
17 | shift |
---|
18 | |
---|
19 | MYLIMIT="" |
---|
20 | for option in 's' 'l' 'n' |
---|
21 | do |
---|
22 | myvalue=$(ulimit "-$option") |
---|
23 | [ -n "$myvalue" ] && MYLIMIT="${MYLIMIT} ulimit -$option $myvalue;" |
---|
24 | done |
---|
25 | |
---|
26 | MYENV=$( env \ |
---|
27 | | grep "^[ABCDEFGHIJKLMNOPQRSTUVWXYZ]" \ |
---|
28 | | egrep -v "^USER=|^TERM=|^OAR|^SGE_|^LS_COLORS=\ |
---|
29 | |^ENV=|^BASH_ENV=|^HOSTNAME=|^LOGNAME=|^MAIL=\ |
---|
30 | |^MANPATH=|^OMPI_MCA_plm_rsh_agent=|^PWD=\ |
---|
31 | |^SHELL=|^SSH_|^SUDO_COMMAND=|^HOME=|^DISPLAY=\ |
---|
32 | |^SHLVL=" \ |
---|
33 | | sort \ |
---|
34 | | sed -e 's/^/export /; s/=/="/; s/$/"/' \ |
---|
35 | | tr [\\\n] [\;] ) |
---|
36 | |
---|
37 | exec /opt/oar/current/bin/oarsh $HOST "$MYLIMIT $MYENV $@" |
---|
38 | |
---|
39 | exit |
---|
40 | |
---|
41 | ################################################################ |
---|
42 | |
---|
43 | Documentation in Perl POD format (man perlpod) |
---|
44 | |
---|
45 | =head1 NAME |
---|
46 | |
---|
47 | oar-envsh - oarsh with env variable transmit |
---|
48 | |
---|
49 | =head1 SYNOPSIS |
---|
50 | |
---|
51 | oar-envsh node command |
---|
52 | |
---|
53 | =head1 DESCRIPTION |
---|
54 | |
---|
55 | C<oar-envsh> need to be executed inside an OAR cluster. |
---|
56 | It's a simple wrapper around C<oarsh> command |
---|
57 | which is a wrapper around C<ssh> command! |
---|
58 | |
---|
59 | With C<oar-envsh>, almost all env variable are export |
---|
60 | in the new shell except the following: |
---|
61 | |
---|
62 | USER TERM OAR* SGE_* LS_COLORS |
---|
63 | ENV BASH_ENV HOSTNAME LOGNAME MAIL |
---|
64 | MANPATH OMPI_MCA_plm_rsh_agent PWD |
---|
65 | SHELL SSH_* SUDO_COMMAND= HOME DISPLAY |
---|
66 | SHLVL |
---|
67 | |
---|
68 | With C<oar-envsh>, some ulimit are also transfert in the new shell. |
---|
69 | Actually, we only transfert: |
---|
70 | |
---|
71 | -l locked memory |
---|
72 | -n open files |
---|
73 | -s stack size |
---|
74 | |
---|
75 | Alway use C<oarsh>, |
---|
76 | only use C<oar-envsh> if really needed! |
---|
77 | |
---|
78 | |
---|
79 | =head1 SEE ALSO |
---|
80 | |
---|
81 | oarsh |
---|
82 | |
---|
83 | |
---|
84 | =head1 AUTHORS |
---|
85 | |
---|
86 | Written by : |
---|
87 | |
---|
88 | Nicolas Capit, Grenoble - France |
---|
89 | Patrick Begou - Gabriel Moreau, Grenoble - France |
---|
90 | |
---|
91 | |
---|
92 | =head1 LICENSE AND COPYRIGHT |
---|
93 | |
---|
94 | GPL version 2 or later |
---|
95 | |
---|
96 | Copyright (C) 2011-2014 Patrick Begou / LEGI - CNRS UMR 5519 - France |
---|
97 | |
---|
98 | =cut |
---|