This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
wiki:old:customization_tips [2013/07/29 16:23] – [PROMPT BASH for Interactive jobs] neyron | wiki:old:customization_tips [2014/08/29 16:48] – [oarsh completion] neyron | ||
---|---|---|---|
Line 1201: | Line 1201: | ||
====== Users tips ====== | ====== Users tips ====== | ||
===== oarsh completion ===== | ===== oarsh completion ===== | ||
- | //This tip is from Jerome Reybert.// | + | //Tip based on an idea from Jerome Reybert// |
- | "I wanted a simple way to access another | + | In order to complete |
- | <code bash> | + | |
- | $ cat $OAR_NODEFILE | + | |
- | $ oarsh "one of the nodes" | + | |
- | </ | + | |
- | + | ||
- | bash_completion is a better solution. bash_completion seems to be widely available on g5k nodes. You just have to add these lines in your .bashrc, and then try oarsh <TAB> | + | |
<code bash> | <code bash> | ||
- | function _oarsh_complete_() | + | function _oarsh_complete_() { |
- | { | + | if [ -n " |
- | | + | |
- | | + | local list=$(cat $OAR_NODEFILE | uniq | tr '\n' ' ') |
- | | + | COMPREPLY=($(compgen -W " |
- | } | + | fi |
- | | + | } |
+ | complete | ||
</ | </ | ||
+ | Then try oarsh <TAB> | ||
===== PROMPT BASH for Interactive jobs ===== | ===== PROMPT BASH for Interactive jobs ===== | ||
If you want to have a bash prompt with your job id and the remaining walltime then you can add in your ~/.bashrc: | If you want to have a bash prompt with your job id and the remaining walltime then you can add in your ~/.bashrc: | ||
<code bash> | <code bash> | ||
- | | + | if [ " |
- | __oar_ps1_remaining_time(){ | + | __oar_ps1_remaining_time(){ |
- | if [-n " | + | if [ -n " |
- | DATE_NOW=$(date +%s) | + | DATE_NOW=$(date +%s) |
- | DATE_JOB_START=$(stat -c %Y $OAR_NODE_FILE) | + | DATE_JOB_START=$(stat -c %Y $OAR_NODE_FILE) |
- | DATE_TMP=$OAR_JOB_WALLTIME_SECONDS | + | DATE_TMP=$OAR_JOB_WALLTIME_SECONDS |
- | ((DATE_TMP = (DATE_TMP - DATE_NOW + DATE_JOB_START) / 60)) | + | ((DATE_TMP = (DATE_TMP - DATE_NOW + DATE_JOB_START) / 60)) |
- | echo -n " | + | echo -n " |
- | fi | + | fi |
- | } | + | } |
- | PS1='[\\u@\\h|\\W]$([-n " | + | PS1=' |
- | if [-n " | + | if [ -n " |
- | | + | echo "[OAR] OAR_JOB_ID=$OAR_JOB_ID" |
- | echo "[OAR] OAR_JOB_ID=$OAR_JOB_ID" | + | echo "[OAR] Your nodes are:" |
- | echo "[OAR] Your nodes are:" | + | sort $OAR_NODE_FILE | uniq -c | awk ' |
- | sort $OAR_NODE_FILE | uniq -c | awk ' | + | fi |
- | ", | + | fi |
- | " | + | |
- | fi | + | |
- | fi | + | |
</ | </ | ||