source: trunk/oarutils/oar-envsh @ 104

Last change on this file since 104 was 104, checked in by g7moreau, 10 years ago
  • Add support for ulimit -s
File size: 1.9 KB
Line 
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
15HOST=$1
16shift
17
18ulimit_s=$(ulimit -s)
19ulimit_n=$(ulimit -n)
20ulimit_l=$(ulimit -l)
21
22MYENV=$( env \
23   | grep "^[ABCDEFGHIJKLMNOPQRSTUVWXYZ]" \
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=" \
29   | sort \
30   | sed -e 's/^/export /; s/=/="/; s/$/"/' \
31   | tr [\\\n] [\;] )
32
33exec /opt/oar/current/bin/oarsh $HOST "ulimit -s ${ulimit_s}; $MYENV $@"
34
35exit
36
37################################################################
38
39Documentation 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
51C<oar-envsh> need to be executed inside an OAR cluster.
52It's a simple wrapper around C<oarsh> command
53which is a wrapper around C<ssh> command!
54
55With C<oar-envsh>, almost all env variable are export
56in 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
64Alway use C<oarsh>,
65only use C<oar-envsh> if really needed!
66
67
68=head1 SEE ALSO
69
70oarsh
71
72
73=head1 AUTHORS
74
75Written by :
76
77 Nicolas Capit, Grenoble - France
78 Patrick Begou - Gabriel Moreau, Grenoble - France
79
80
81=head1 LICENSE AND COPYRIGHT
82
83GPL version 2 or later
84
85Copyright (C) 2011 Patrick Begou / LEGI - CNRS UMR 5519 - France
86
87=cut
Note: See TracBrowser for help on using the repository browser.