Browse code

bash_profile (heron) - v2.1 - Correct bugs

Fred authored on26/07/2016 14:36:30
Showing1 changed files
... ...
@@ -1,14 +1,15 @@
1 1
 # Title: .bash_profile
2 2
 # Author: Frédéric CHEVALIER <f15.chevalier@gmail.com>
3
-# Version: 2.0
3
+# Version: 2.1
4 4
 # Created in: 2012-05-25
5
-# Modified in: 2016-06-12
5
+# Modified in: 2016-07-25
6 6
 
7 7
 
8 8
 #==========#
9 9
 # Versions #
10 10
 #==========#
11 11
 
12
+# v2.1 - 2016-07-25: bug about space corrected / exit if not interactive (due to Grid Engine)
12 13
 # v2.0 - 2016-06-12: PATH setup improved / start_agent with multikey management / start_agent calling improved / screen behaviour added / welcome message improved / alias updated
13 14
 # v1.10 - 2015-08-17: Python lib adapted to the current version of Python / Consed env variable added / plocate updated to handle several db / pypm alias added / library path updated
14 15
 # v1.9 - 2015-04-20: Python env variable added / alias updated
... ...
@@ -29,6 +30,11 @@
29 30
 # Get the aliases and functions #
30 31
 #===============================#
31 32
 
33
+# If not running interactively, don't do anything
34
+## Required because Grid Engine runs any shell as login shell by default leading to unwanted messages in the job status
35
+[[ -z "$PS1" ]] && return
36
+
37
+# Load bashrc file
32 38
 if [[ -f ~/.bashrc ]]
33 39
 then
34 40
 	source ~/.bashrc
... ...
@@ -134,7 +140,7 @@ export R_LIBS="${R_LIBS_HOME}/${R_version}"
134 140
 # SSH environment setup
135 141
 SSH_KEY_LIST="$HOME/.ssh/key_list"  # File with full path of keys (one per line) to load with start_agent
136 142
 [[ -f "$SSH_KEY_LIST" ]] && SSH_KEYS=($(cat $SSH_KEY_LIST))
137
-lifetime=259200 # seconds => 3 days
143
+#lifetime="-t 259200" # seconds => 3 days
138 144
 
139 145
 if [[ ! $HOSTNAME =~ compute.* ]]
140 146
 then
... ...
@@ -149,10 +155,10 @@ then
149 155
             if [[ $(ssh-add -l &> /dev/null; echo $?) != 0 ]]
150 156
             then
151 157
                 pkill -u $USER ssh-agent
152
-                eval start_agent -t $lifetime ${SSH_KEYS[@]}
158
+                eval start_agent $lifetime ${SSH_KEYS[@]}
153 159
             fi
154 160
         else
155
-            eval start_agent -t $lifetime ${SSH_KEYS[@]}
161
+            eval start_agent $lifetime ${SSH_KEYS[@]}
156 162
         fi
157 163
     fi
158 164
 fi
... ...
@@ -211,7 +217,7 @@ then
211 217
 fi
212 218
 
213 219
 # Info on disk space and cores
214
-if [[ $name != "heron" && (-z $LC_STY || $LC_STY != 1) ]]
220
+if [[ ! ($HOSTNAME =~ heron* || $HOSTNAME =~ compute.*) && (-z $LC_STY || $LC_STY != 1) ]]
215 221
 then
216 222
     mydisk="/master /data"
217 223
     echo ""