source: trunk/oarutils/oar-envsh @ 49

Last change on this file since 49 was 29, checked in by g7moreau, 12 years ago
  • Manual for oar-envsh
File size: 1.8 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
18MYENV=$( 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
29exec /opt/oar/current/bin/oarsh $HOST "$MYENV $@"
30
31exit
32
33################################################################
34
35Documentation 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
47C<oar-envsh> need to be executed inside an OAR cluster.
48It's a simple wrapper around C<oarsh> command
49which is a wrapper around C<ssh> command!
50
51With C<oar-envsh>, almost all env variable are export
52in 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
60Alway use C<oarsh>,
61only use C<oar-envsh> if really needed!
62
63
64=head1 SEE ALSO
65
66oarsh
67
68
69=head1 AUTHORS
70
71Written by :
72
73 Nicolas Capit, Grenoble - France
74 Patrick Begou - Gabriel Moreau, Grenoble - France
75
76
77=head1 LICENSE AND COPYRIGHT
78
79GPL version 2 or later
80
81Copyright (C) 2011 Patrick Begou / LEGI - CNRS UMR 5519 - France
82
83=cut
Note: See TracBrowser for help on using the repository browser.