Suse just reported a problem about ksh 64bit crashes. Does anyone know
if the bug affects Solaris on AMD64 or SPARC, too?

---------- Forwarded message ----------
From: Dr. Werner Fink <wer...@suse.de>
Date: Aug 27, 2007 4:43 PM
Subject: [ast-users] Crash on 64bit system with vmalloc from libast
To: ast-users at research.att.com


Hi,

just found by ksh user on s390x but also valid on x86_64 ...
the sniplet below crashes not only ksh93r but also ksh93s.
GDB states most time a SIGSEGV at

bestreclaim() in src/lib/libast/vmalloc/vmbest.c:520
bestsearch()  in src/lib/libast/vmalloc/vmbest.c:351

but also at line 291 in src/lib/libast/vmalloc/vmbest.c
the crash occurs.  Interessting that the addresses at
this point for the left part of the tree are 0xffffffff
(which is not -1UL but -1U) or simply -1UL + address.

-------------------------* snip *---------------------------------
#!/bin/ksh
#BSUB -J "one_elementT1"
#BSUB -R "select[(transfer)]"
#BSUB -L "/bin/ksh"
#BSUB -o "/tmp/caejobs/qx04803/ABAQUS/BMW/flowguide/abaqus/one_element.EO"


PATH="${PATH}:/usr/local/bin:/bin:/usr/bin:/usr/bsd:/usr/local/lsf/bin"


if [[ "x${__FLOWGUIDE_COMMON_FUNCTIONS_DEFINED__:-}" = "x" ]] ; then
__FLOWGUIDE_COMMON_FUNCTIONS_DEFINED__=1


if [[ "x${__FLOWGUIDE_SETUP_DEFINED__:-}" = "x" ]] ; then
__FLOWGUIDE_SETUP_DEFINED__=1



: ${_fg_debug:="32"}
: ${_fg_stderrFile:=""}
: ${_fg_functionStderrHandle:="2"}

: ${_fg_shellFlags:="f"}

: ${_fg_logFlags:="3"}
: ${_fg_logCommand:='print -r -- "$*"'}
: ${_fg_logRedirection:=''}

typeset -i _fg_LOG_ERROR=1                  ; typeset -r _fg_LOG_ERROR
typeset -i _fg_LOG_WARNING=2                ; typeset -r _fg_LOG_WARNING
typeset -i _fg_LOG_FUNCTION_START=4         ; typeset -r _fg_LOG_FUNCTION_START
typeset -i _fg_LOG_FUNCTION_PARAMETERS=8    ; typeset -r
_fg_LOG_FUNCTION_PARAMETERS
typeset -i _fg_LOG_FUNCTION_RESULT=16       ; typeset -r _fg_LOG_FUNCTION_RESULT
typeset -i _fg_LOG_FUNCTION_INTERALS1=256   ; typeset -r
_fg_LOG_FUNCTION_INTERALS1
typeset -i _fg_LOG_FUNCTION_INTERALS2=512   ; typeset -r
_fg_LOG_FUNCTION_INTERALS2
typeset -i _fg_LOG_FUNCTION_INTERALS3=1024  ; typeset -r
_fg_LOG_FUNCTION_INTERALS3
typeset -i _fg_LOG_FUNCTION_INTERALS4=2048  ; typeset -r
_fg_LOG_FUNCTION_INTERALS4
typeset -i _fg_DEBUG_SCRIPT_EXECUTION=1     ; typeset -r
_fg_DEBUG_SCRIPT_EXECUTION
typeset -i _fg_DEBUG_APPLICATION_EXECUTION=2 ; typeset -r
_fg_DEBUG_APPLICATION_EXECUTION
typeset -i _fg_DEBUG_FUNCTION_START=16      ; typeset -r
_fg_DEBUG_FUNCTION_START
typeset -i _fg_DEBUG_FUNCTION_EXECUTION=32  ; typeset -r
_fg_DEBUG_FUNCTION_EXECUTION
typeset -i _fg_DEBUG_FUNCTION_REXEC=64      ; typeset -r
_fg_DEBUG_FUNCTION_REXEC


: ${_fg_currentFunctionName:="noFunction"}


: ${_fg_SETUP_bootstrap:="
if [[ -n \"\${_fg_stderrFile}\" ]] ; then
  (( \$_fg_functionStderrHandle != 2 )) || _fg_functionStderrHandle=9
  eval \"exec \$_fg_functionStderrHandle>>\\\"\\\${_fg_stderrFile}\\\"\"
  exec 2>&\"\$_fg_functionStderrHandle\"
else
  (( \$_fg_functionStderrHandle == 2 )) || eval \"exec
\$_fg_functionStderrHandle>&2\"
fi

whence -v _fg_isDefined >/dev/null 2>&1 || _fg_isDefined() {
  whence -v \"\$1\" >/dev/null 2>&1
}

_fg_generateFunctionImplementation_debug=\"0\"
_fg_isDefined _fg_generateFunctionImplementation || function
_fg_generateFunctionImplementation {
  set +x ; _fg_isDefined _fg_getFunctionInitCode && \\
  eval \"\$(_fg_getFunctionInitCode \"_fg_generateFunctionImplementation\")\"
  typeset mode=\"normal\"
  typeset name
  if [[ \"\$1\" = \"--defineVars\" ]] ; then
    mode=\"\$1\" ; shift
    name=\"\$1\" ; shift
  elif [[ \"\$1\" = \"--defineFunctions\" ]] ; then
    mode=\"\$1\" ; shift
    name=\"\$_fg_NextFunctionName\"
    unset _fg_NextFunctionName
  else
    name=\"\$1\" ; shift
  fi
  typeset noWrapper
  typeset param
  for param ; do
    eval \": \\\${\${name}_\${param%%=*}:=\\\"\\\${param#*=}\\\"}\"
  done
  if [[ \"\$mode\" = \"--defineVars\" ]] ; then
    _fg_NextFunctionName=\"\$name\"
    return 0
  fi
  eval \"noWrapper=\\\"\\\${\${name}_noWrapper}\\\"\"

  typeset code=\"\$(dd 2>/dev/null)\"
  eval \"code=\\\"\\\${\${name}_code:=\\\${code}}\\\"\" || :
  _fg_isDefined \${name} || if [[ -z \"\$noWrapper\" ]] ; then
    eval \"function \$name { set +x ;
      typeset caller=\\\"\\\${_fg_currentFunctionName:-\\\"noFunction\\\"}\\\"
      typeset PS4saved=\\\"\\\$PS4\\\" ; PS4=\\\"\\\$PS4    \\\" ;
_fg_currentFunctionName=\\\"\$name\\\"
      _fg_preFunctionExec \\\"\$name\\\" \\\"\...@\\\" || :
      \${name}_implementation \\\"\...@\\\"
2>&\\\"\\\$_fg_functionStderrHandle\\\" && :
      typeset result=\\\"\\\$?\\\"
      _fg_postFunctionExec \"\$name\" \\\"\\\$result\\\" \\\"\...@\\\" || :
      PS4=\\\"\\\$PS4saved\\\" ; _fg_currentFunctionName=\\\"\\\$caller\\\"
      return \\\"\\\$result\\\"
    }\"
  elif [[ \"\$noWrapper\" = \"mini\" ]] ; then
    eval \"function \$name { set +x ;
      eval \\\"\\\$(_fg_getFunctionInitCode \\\"\${name}\\\")\\\"
      \${code}
    }\"
  elif [[ \"\$noWrapper\" = \"plain\" ]] ; then
    eval \"function \$name { \${code}
    }\"
  else
    eval \"function \$name { set +x ;
      \${name}_implementation \\\"\...@\\\"
2>&\\\"\\\$_fg_functionStderrHandle\\\" && :
    }\"
  fi
  [[ \"\$noWrapper\" = \"mini\" ]] || [[ \"\$noWrapper\" = \"plain\" ]] || \\
    eval \"_fg_isDefined \${name}_implementation || function
\${name}_implementation {
      eval \\\"\\\$(_fg_getFunctionInitCode \\\"\${name}\\\")\\\"
      \${code}
    }
  \"
}
if (( \$_fg_debug & \$_fg_DEBUG_SCRIPT_EXECUTION )) ; then
  set -x
fi
"}
eval "$_fg_SETUP_bootstrap"

_fg_generateFunctionImplementation _fg_debugFunctionInit noWrapper=plain code="
{
  typeset name=\"\$1\" ; shift
  print -r -- \"\${PS4}#\" 1>&2
  print -r -- \"\${PS4}# ------ Start of Function \${name} ------\" 1>&2
  print -r -- \"\${PS4}# Arg #:\$#  Shell-Flags: '\$-'\" 1>&2

  typeset -i count=1
  while (( \$# > 0 )) ; do
    print -r -- \"\${PS4}# Arg \${count}: '\$1'\" 1>&2
    let 'count=count+1'
    shift
  done
  print -r -- \"\${PS4}#\" 1>&2
}
" </dev/null

_fg_generateFunctionImplementation _fg_getFunctionInitCode
noWrapper=plain code="
{
  print -r \\
\"if (( \\\${\${1}_debug:-\\\${_fg_debug:-0}} >=
\$_fg_DEBUG_FUNCTION_START )) ; then\"'
  _fg_isDefined _fg_debugFunctionInit && _fg_debugFunctionInit
\"'\"\$1\"'\" \"\...@\"'\"
  (( \\\${\${1}_debug:-\\\${_fg_debug:-0}} &
\$_fg_DEBUG_FUNCTION_EXECUTION )) && set -x\"'
fi'
}
" </dev/null

_fg_generateFunctionImplementation _fg_emitMessage noWrapper=mini \
debug="0" code=\
"{
  typeset cmd=\"\$1\" ; shift
  typeset redirect=\"\$1\" ; shift
  eval \"{ \$cmd ; } \$redirect\" || : # ignore errors at this point
}
" </dev/null

_fg_generateFunctionImplementation _fg_normalMessage noWrapper=mini \
debug="0" code=\
"{
  (( \$# == 0 )) || _fg_emitMessage \"\$_fg_logCommand\" \\
   \"\$_fg_logRedirection\" \"\...@\"
}
" </dev/null

_fg_generateFunctionImplementation _fg_print_fg_AR noWrapper=plain code="
{
  set +x
  if [[ -z \${_fg_AR+set} ]] ; then
    [[ -z \"\$1\" ]] && return 0
    shift
    print -r -- \"\...@\"\"_fg_AR not set\"
    return 0
  fi
  shift
  print -r -n -- \"\...@\"\"_fg_ar[\${#_fg_...@]}] =\"
  set -- \"\${_fg_...@]}\"
  while (( \$# > 0 )); do print -n -r -- \" '\$1'\" ; shift ; done
  print -r -- ''
}
" </dev/null

_fg_generateFunctionImplementation _fg_preFunctionExec noWrapper=mini \
debug="0" code=\
"{
  typeset name=\"\$1\" ; shift
  unset _fg_AR || :
  eval \"typeset -i logFlags=\\\${\${name}_logFlags:-\\\${_fg_logFlags:-0}}\"
  if (( \$logFlags & \$_fg_LOG_FUNCTION_START )) ; then
    typeset msg=\"\$name\"
    if (( \$logFlags & \$_fg_LOG_FUNCTION_PARAMETERS )) ; then
      msg=\"\$msg \$*\"
    fi
    _fg_normalMessage \"\$msg\"
  fi
}
" </dev/null

_fg_generateFunctionImplementation _fg_postFunctionExec noWrapper=mini \
debug="0" code=\
"{
  typeset name=\"\$1\" ; shift
  typeset result=\"\$1\" ; shift
  eval \"typeset -i debug=\\\${\${name}_debug:-\\\${_fg_debug:-0}}\"
  if (( \$debug >= \$_fg_DEBUG_FUNCTION_START )) ; then
    print -r -- \"\${PS4}# \$name return: \$result\"
\"\$(_fg_print_fg_AR always ' ')\" 1>&\"\$_fg_functionStderrHandle\"
  fi
  eval \"typeset -i logFlags=\\\${\${name}_logFlags:-\\\${_fg_logFlags:-0}}\"
  if (( \$logFlags & \$_fg_LOG_FUNCTION_RESULT )) ; then
    _fg_normalMessage \"\$(_fg_print_fg_AR '' \" \$name returned: \$result \")\"
  fi
}
" </dev/null


_fg_generateFunctionImplementation --defineVars "_fg_setReturnValue" \
debug="" \
logFlags="" \
requires="" \
noWrapper="1"
_fg_setReturnValue_code=\
"

{
  return \${1:-0}
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_setShellFlags" \
debug="" \
logFlags="" \
requires="" \
noWrapper="1"
_fg_setShellFlags_code=\
"

{
  typeset flags=\"\$(print -r - \"\$_fg_shellFlags\" | tr -d -c 'efuv')\"
  print -r -n -- \"set +efuv \"
  if [[ -n \"\$flags\" ]] ; then
    print -r -n -- \"&& set '-\$flags' \"
  fi
  print -r -- \"&& _fg_setReturnValue '\${1:-0}' && :\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



eval "$(_fg_setShellFlags)"

fi





_fg_generateFunctionImplementation --defineVars "_fg_mapSeparator" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_mapSeparator_code=\
"

{
    print -r -- \"\$1\" | tr '\\\\' '/'
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_mapWinPath2Unix" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_mapWinPath2Unix_code=\
"

{
  typeset drive=\"\"
  typeset winpath=\$1
  typeset cnt=0
  typeset splitarr
  shift

  mapWinDrives2Unix='L: /;Z: /proj/XXXXX;H: /home/XXXXX;'
  IFSorg=\${IFS}
  IFS=\":\"
  set -- \$winpath
  IFS=\${IFSorg}

  if [ \$# -lt 2 ]; then
#    echo \"mapWinPath2UNix: No full windows path specified\" >&2
    print -r -- \"\${winpath}\" |tr -s /
    err=0  # it is not realy an error to call mapWinPath2UNix for an unix path
    return \$err
  fi

  drive=\$1
  winpath=\$2
  if [ -n \"\$winpath\" ]; then
    winpath=\$(_fg_mapSeparator \"\${winpath}\")
  fi

  err=2
  if [ -n \"\$drive\" ]; then
    drive=\$1

    IFSorg=\${IFS}
    IFS=\";\"
    set -- \${mapWinDrives2Unix}
    IFS=\${IFSorg}

    set -A splitarr \"\...@\"
    while [ \$cnt -le \${#splita...@]} ]; do
        entry=\${splitarr[\$cnt]}
        set -- \$entry
        [ -z \$1 ] && break
        if [ \$1 = \"\${drive}:\" ]; then
            winpath=\"\$2/\${winpath}\"
            err=0
            break
        fi
        let cnt=cnt+1
    done
    [ \$err -gt 0 ] && echo \"mapWinPath2UNix: No drive mapping found
for drive: \$drive !\" >&2
  fi
  print -r -- \"\${winpath}\"|tr -s /
  return \$err
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null





_fg_generateFunctionImplementation --defineVars "_fg_Sane" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_Sane_code=\
"

{

  typeset foundI_WANT_A_BROKEN_PS
  typeset savedI_WANT_A_BROKEN_PS
  typeset ret

  if _fg_isDefinedVar I_WANT_A_BROKEN_PS ; then
    foundI_WANT_A_BROKEN_PS=1
    savedI_WANT_A_BROKEN_PS=\"\$I_WANT_A_BROKEN_PS\"
    unset I_WANT_A_BROKEN_PS
  fi

  PATH=\"/usr/xpg6/bin:/usr/xpg4/bin:\$PATH\" _XPG=1 UNIX95=1
LC_ALL=POSIX \"\...@\"
  ret=\"\$?\"

  if [[ \"x\$foundI_WANT_A_BROKEN_PS\" = \"x1\" ]] ; then
    export I_WANT_A_BROKEN_PS=\"\$savedI_WANT_A_BROKEN_PS\"
  fi
  return \"\$ret\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_isDefinedVar" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_isDefinedVar_code=\
"

{
  eval \"[[ -n \\\"\\\${\$1+set}\\\" ]] && :\" && :
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_Log" \
debug="" \
logFlags="" \
requires="" \
noWrapper="1"
_fg_Log_code=\
"

{
  eval \"typeset -i
logFlags=\\\${\${_fg_currentFunctionName}_logFlags:-\\\${_fg_logFlags:-0}}\"
  typeset -i flag=\"\$1\" ; shift
  (( \$logFlags & \$flag )) && _fg_normalMessage \"\...@\"
  return 0
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_Error" \
debug="" \
logFlags="" \
requires="" \
noWrapper="1"
_fg_Error_code=\
"

{
  eval \"typeset -i
logFlags=\\\${\${_fg_currentFunctionName}_logFlags:-\\\${_fg_logFlags:-0}}\"
  if (( \$logFlags & \$_fg_LOG_ERROR )) ; then
    _fg_emitMessage \"\$_fg_logCommand\" \\
     \"\$_fg_logRedirection\" \"Error: \"\"\...@\"
  fi
  return 1
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_Warn" \
debug="" \
logFlags="" \
requires="" \
noWrapper="1"
_fg_Warn_code=\
"

{
  eval \"typeset -i
logFlags=\\\${\${_fg_currentFunctionName}_logFlags:-\\\${_fg_logFlags:-0}}\"
  if (( \$logFlags & \$_fg_LOG_WARNING )) ; then
    _fg_emitMessage \"\$_fg_logCommand\" \\
     \"\$_fg_logRedirection\" \"Warning: \"\"\...@\"
  fi
  return 0
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_makeSaneFileName" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_makeSaneFileName_code=\
"

{
  print -r \"\$1\" | tr \"/\\\\ \\t\\n\\r\\\"'\" '_'
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_setLOCAL_HOST" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_setLOCAL_HOST_code=\
"

{
  # set -x
  typeset host
  if [[ -z \"\$LOCAL_HOST_LONG\" || -z \"\$LOCAL_HOST_SHORT\" ]] ; then
    typeset os=\"\$(_fg_Sane uname)\"
    case \"\$os\" in
      Linux*)
              host=\"\$(_fg_Sane hostname -f)\"
              ;;
      AIX*)
            # host=\"\$(host \"\$(hostname)\" | cut -f1 -d' ')\"
            host=\"\$(_fg_Sane /usr/sbin/ping -c 1 \"\$(hostname)\" |
sed -n -e '1s/^PING \\([^ ]*\\).*/\\1/p')\"
            ;;
      HP*)
           host=\"\$(_fg_Sane /etc/ping \"\$(hostname)\" -n 1 | sed -n
-e '1s/^PING \\([^:]*\\).*/\\1/p')\"
           ;;
      OSF*)
            host=\"\$(_fg_Sane /usr/sbin/ping -c1 \"\$(hostname)\"|
sed -n -e '1s/^PING \\([^ ]*\\).*/\\1/p')\"
            ;;
      IRIX*)
             host=\"\$(_fg_Sane /usr/etc/ping -c1 \"\$(hostname)\"|
sed -n -e '1s/^PING \\([^ ]*\\).*/\\1/p')\"
             ;;
      SunOS*)
              host=\"\$(_fg_Sane /usr/bin/getent hosts
\"\$(hostname)\" | tr '\\t' ' ' | sed -e 's/^[0-9. ]*\\([^
]*\\).*/\\1/')\"
              ;;
      FreeBSD*)
                host=\"\$(_fg_Sane /sbin/ping -c 1 \"\$(hostname)\" |
sed -n -e '1s/^PING \\([^ ]*\\).*/\\1/p')\"
                ;;
      *)
         host=\"\$(_fg_Sane hostname)\"
         ;;
    esac
  fi

  LOCAL_HOST_LONG=\"\${LOCAL_HOST_LONG:-\"\${host}:\"}\"
  LOCAL_HOST_SHORT=\"\${LOCAL_HOST_SHORT:-\"\$(_fg_Sane uname -n):\"}\"
  LOCAL_HOST=\"\${LOCAL_HOST:-\"\$LOCAL_HOST_LONG\"}\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_setRSH" \
debug="" \
logFlags="" \
requires="AUTO RSH" \
noWrapper=""
_fg_setRSH_code=\
"

{
  RSH=\"\${RSH:-\"rsh\"}\"
  typeset OS=\"\$(_fg_Sane uname)\"
  typeset iscray=\"\$(print -r \"\$OS\" | grep '^sn')\"

  if [ \"\$OS\" = \"HP-UX\" -o \"\$OS\" = \"\$iscray\" ]; then
    [ \"\${RSH##*/}\" = \"rsh\" ] && RSH=\"\${RSH%rsh}remsh\"
  fi
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_setRCP" \
debug="" \
logFlags="" \
requires="AUTO RCP" \
noWrapper=""
_fg_setRCP_code=\
"

{
  RCP=\"\${RCP:-'rcp'}\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_setUSER" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_setUSER_code=\
"

{
  USER=\"\${USER:-\"\$(_fg_Sane id -un)\"}\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_setHOME" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_setHOME_code=\
"

{
  HOME=\"\${HOME:-\"\$(cd ; pwd)\"}\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null





_fg_generateFunctionImplementation --defineVars "_fg_isLocal" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_isLocal_code=\
"

{
  if [ -z \"\$1\" -o \"\$1\" = \"localhost\" ] ; then
    return 0
  else
    _fg_setLOCAL_HOST
    if [ \"\$1\" = \"\${LOCAL_HOST_LONG%:}\" -o \"\$1\" =
\"\${LOCAL_HOST_SHORT%:}\" ] ; then
      return 0
    fi
  fi
  return 1
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_isCurrentUser" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_isCurrentUser_code=\
"

{
  _fg_setUSER
  if [ -z \"\$1\" -o \"\$1\" = \"\$USER\" ] ; then
    return 0
  fi
  return 1
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_RshProcessOptions" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_RshProcessOptions_code=\
"

{
  typeset caller=\"\$1\" ; shift
  typeset arg
  typeset flag_n
  typeset flag_l
  typeset user
  typeset host
  typeset flag_host
  typeset cmd
  typeset -i argCount=0

  # process parameters
  while [ \$# -gt 0 ] ; do
    arg=\"\$1\"
    let 'argCount=argCount+1'
    shift

    case \"\$arg\" in
      -n)
          if [[ -z \"\$flag_n\" ]] ; then
            flag_n=\"-n\"
          else
            _fg_Warn \"\${caller}\", \"found unexpected '-n' as
argument \$argCount\"
          fi
          ;;
      -l)
          if [[ -z \"\$flag_l\" ]] ; then
            flag_l=\"-l\"
            if [[ \"x\$1\" != \"x\" ]] ; then
              user=\"\$1\"
              let 'argCount=argCount+1'
              shift
            else
              _fg_Error \"\${caller}\", \"expected user-name as
argument \$argCount\"
              return \$?
            fi
          else
            _fg_Warn \"\${caller}\", \"found unexpected '-l' as
argument \$argCount\"
          fi
          ;;
      -l*)
           if [[ -z \"\$flag_l\" ]] ; then
             flag_l=\"-l\"
             user=\"\${arg#-l}\"
           else
             _fg_Warn \"\${caller}\", \"found unexpected '\$arg' as
argument \$argCount\"
           fi
           ;;
      *)
         if [[ -z \"\$flag_host\" ]] ; then
           flag_host=1
           host=\$(expr match \"\$arg\" '\\([...@]*@\\)' || :)
           if [[ -n \"\$host\" ]] ; then
             flag_l=\"-l\"
             user=\"\${ho...@}\"
             host=\"\${ar...@}\"
           else
             host=\"\$arg\"
           fi
         else
           cmd=\"\$arg\"
           break
         fi
         ;;
    esac
  done
  set -A _fg_AR -- \"\$host\" \"\$flag_n\" \"\$flag_l\" \"\$user\"
\"\$cmd\" \"\...@\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_RemoteScript" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_RemoteScript_code=\
"

{
  # set -x

  _fg_RshProcessOptions _fg_RSH \"\...@\"
  set -- \"\${_fg_...@]}\"

  typeset host=\"\$1\" ; shift
  typeset flag_n=\"\$1\" ; shift
  typeset flag_l=\"\$1\" ; shift
  typeset user=\"\$1\" ; shift
  typeset -i flag_detach=0
  if [[ \"x\$1\" = \"x--detachScript\" ]] ; then
    flag_detach=1
    shift
  fi
  typeset script=\"\$(dd 2>/dev/null)\"
  _fg_Log \$_fg_LOG_FUNCTION_INTERALS2 \"executing script on \$host
\${user:+ user \${user}} args: \$@
\$script\"

  typeset id=\"id\$( print -r - \"\${host}\$\$\" | sed -e
's/[^_A-Za-z0-9]/_/g')\"

  {
    print -r - \"_fg_RemoteScript\${id}() {\"
    print -r - \"unset -f _fg_RemoteScript\${id}\"
    if (( flag_detach == 1 )) ; then
        print -r - 'stdin=\"\$(dd 2>/dev/null; print -rn - X)\"'
        print -r -- 'exec 1>&- 2>&-'
        print -r -- 'exec 1>/dev/null 2>&1'
        print -rn - \"{ { print -nr -- '\"
        {
          print -r - \"_fg_RemoteScript2\${id}() {\"
          print -r - \"unset -f _fg_RemoteScript2\${id}\"
          print -r -- \"\${script}\"
          print -r - 'return \$?'
          print -r - '}'
          if [[ \"xtrue\" = \"xtrue\" ]] && [[ -z \"\$flag_n\" ]] ; then
             print -rn - \"cat | \"
          fi
          print -rn - \"_fg_RemoteScript2\${id}\"
          while ((\$# > 0)) ; do
             print -rn -- \" '\"
             print -rn -- \"\$1\" | \\
             LC_ALL=POSIX perl -pe \"s/'/'\\\"'\\\"'/g\"
             print -rn -- \"'\"
             shift
          done
          print -r - ' ; exit \$?'
        } | LC_ALL=POSIX perl -pe \"s/'/'\\\"'\\\"'/g\"
        print -r -- \"'\"
        print -r -- 'print -rn -- \"\${stdin%X}\"'
        print -r -- '} | ksh -s ; } &'
    else
        print -r - \"\${script}\"
    fi
    print -r - 'return \$?'
    print -r - '}'
    if [[ \"xtrue\" = \"xtrue\" ]] && [[ -z \"\$flag_n\" ]] ; then
          print -rn - \"cat | \"
    fi
    print -rn - \"_fg_RemoteScript\${id}\"
    while ((\$# > 0)) ; do
          print -rn -- \" '\"
          print -rn -- \"\$1\" | \\
          LC_ALL=POSIX perl -pe \"s/'/'\\\"'\\\"'/g\"
          print -rn -- \"'\"
          shift
    done
    print -r - ' ; exit \$?'
    if [[ -z \"\$flag_n\" ]] ; then
          if (( _fg_RemoteScript_logFlags & _fg_LOG_FUNCTION_INTERALS3 )) ; then
            typeset stdin=\"\$(dd 2>/dev/null 0<&8 ; print X)\";
stdin=\"\${stdin%X}\"
            _fg_normalMessage \"Script STDIN is:
\" \"\${stdin}\"
            print -nr -- \"\${stdin}\"
          else
            dd 2>/dev/null 0<&8
          fi
    fi
   } | \\
   {
     if _fg_isLocal \"\$host\" && _fg_isCurrentUser \"\$user\" ; then
        ( cd ; /bin/ksh -s )
     else
        typeset rshOptions
        if [[ -n \"\$flag_l\" ]] ; then
           rshOptions=\"\$rshOptions -l \$user\"
        fi
        _fg_setRSH
        {
          \$RSH \"\$host\" \$rshOptions \"/bin/ksh -s ; echo
ExitCode\${id}_\"'\$?' || \\
          print -r \"ExitCode\${id}_\$?\"
        } | \\
        LC_ALL=POSIX perl -pe
'if(/ExitCode'\"\${id}\"'_(\\d+)\$/){print \"\$\`\";exit \$1}'
    fi
  }
  return \$?
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_ExecRemotePerl" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_ExecRemotePerl_code=\
"

{
  _fg_RshProcessOptions _fg_RSH \"\...@\"
  set -- \"\${_fg_...@]}\"
  typeset host=\"\$1\" ; shift
  typeset flag_n=\"\$1\" ; shift
  typeset flag_l=\"\$1\" ; shift
  typeset user=\"\$1\" ; shift

  typeset id=\"idRemotePerl\$( print -r \"\${host}\$\$\" | sed -e
's/[^_A-Za-z0-9]/_/g')\"
  {
    dd 2>/dev/null
    print -r -- \"End\${id}\"
    if [[ -z \"\$flag_n\" ]] ; then
      dd 2>/dev/null 0<&8
    fi
  } | \\
  _fg_RemoteScript \"\$host\" \${flag_l}\${user} \"\...@\" 8<&0 <<EOF
perl -e 'while(sysread(STDIN,\\\$b,1)){\\\$_.=\\\$b;if(/End'\$id'\\n\\\$/){undef
\\\$b;eval \\\$\\\`;exit}}print\"EOF:\\\$!\\n\";' -- \"\...@\"
EOF
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_RExec" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_RExec_code=\
"

{
  _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 _fg_RExec \"\...@\"
  exec 8<&0
  print -r - 'typeset cmd=\"\$1\"
shift
\$cmd \"\...@\"' | _fg_RemoteScript \"\...@\"
  typeset -i retval=\"\$?\"
  exec 8<&-
  return \$retval
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null




_fg_generateFunctionImplementation --defineVars "_fg_RSH" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_RSH_code=\
"

{
  # set -x

  _fg_RshProcessOptions _fg_RSH \"\...@\"
  set -- \"\${_fg_...@]}\"
  typeset host=\"\$1\" ; shift
  typeset flag_n=\"\$1\" ; shift
  typeset flag_l=\"\$1\" ; shift
  typeset user=\"\$1\" ; shift
  typeset cmd=\"\$1\" ; shift

  if _fg_isLocal \"\$host\" && _fg_isCurrentUser \"\$user\" ; then
    if [[ -n \"\$flag_n\" ]] ; then
      _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 \"( cd ; /bin/ksh -c
\"'\"'\"\$cmd \$*\"'\"'\" ) </dev/null\"
      ( cd ; /bin/ksh -c \"\$cmd \$*\" ) </dev/null
    else
      _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 \"( cd ; /bin/ksh -c
\"'\"'\"\$cmd \$*\"'\"'\" )\"
      ( cd ; /bin/ksh -c \"\$cmd \$*\" )
    fi
  else
    typeset rshOptions
    typeset id=\"id\$( print -r - \"\${host}\$\$\" | sed -e
's/[^_A-Za-z0-9]/_/g')\"
    if [[ -n \"\$flag_l\" ]] ; then
      rshOptions=\"\$rshOptions -l \$user\"
    fi
    _fg_setRSH
    if [[ -z \"\$flag_n\" ]] ; then
      _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 \$RSH \"\$host\"
\$rshOptions '\"'\"\$cmd \$*\"'\"'
    else
      _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 \$RSH \"\$host\" -n
\$rshOptions '\"'\"\$cmd \$*\"'\"'
    fi
    {
        print -r - \"_fg_Rsh\${id}() {\"
        print -r - \"unset -f _fg_Rsh\${id}\"
        print -r - \"\$cmd \$*\"
        print -r - 'return \$?'
        print -r - '}'
        if [[ \"xtrue\" = \"xtrue\" ]] && [[ -z \"\$flag_n\" ]] ; then
          print -rn - \"cat | \"
        fi
        print -r - \"_fg_Rsh\${id}\"' ; exit \$?'
        if [[ -z \"\$flag_n\" ]] ; then
          dd 2>/dev/null
        fi
    } | \\
    {
       \$RSH \"\$host\" \$rshOptions \"/bin/ksh -s ; echo
ExitCode\${id}_\"'\$?' || \\
       print -r - \"ExitCode\${id}_\$?\"
    } | \\
    LC_ALL=POSIX perl -pe 'if(/ExitCode'\"\${id}\"'_(\\d+)\$/){print
\"\$\`\";exit \$1}'
  fi

  return \$?
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_remoteMakePath" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_remoteMakePath_code=\
"

{
  _fg_RSH \"\$1\" -n '[[ -d '\"'\$2'\"' ]] || mkdir -p '\"'\$2'\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_makeAbsolutePath" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_makeAbsolutePath_code=\
"

{
  typeset path=\"\$1\"
  case \"\$path\" in
    /*)
        :
        ;;
    *)
       typeset base=\"\${2:-\$(pwd)}\"
       case \"\$base\" in
         /*)
             :
             ;;
         *)
            _fg_Error \"Absolute Path expected, but I got '\$base'\"
            return 1
            ;;
       esac
       path=\"\${base%/}/\$path\"
       ;;
  esac
  print -r - \"\$path\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null




_fg_generateFunctionImplementation --defineVars "_fg_RCP" \
debug="" \
logFlags="259" \
requires="" \
noWrapper=""
_fg_RCP_code=\
"

{
#  set -x
  # quote SPACE, TAB, '\"\`\$#!;&(){}[]|<>  and '\\'
  typeset sedCmd='s/\\([]\$[!;&(){}|<>\`\"#'\"'\"'      \\\\]\\)/\\\\\\1/g'
  typeset arg
  typeset userAndHost
  typeset user
  typeset host
  typeset ifsSaved=\"\$IFS\"
  typeset -i lastOpt=0
  typeset opts
  typeset optional=0
  typeset err
  typeset args
  typeset targetIsLocal=0
  typeset srcIsLocal=0
  typeset rcpCmd
  typeset retryCmd
  typeset target
  typeset quotedtarget
  typeset file
  typeset src
  typeset argsTmp
  _fg_setHOME

  # process options
  while (( \$# > 0 )) && (( lastOpt == 0 )) ; do
    # get the first option
    arg=\"\$1\"
    case \"\$arg\" in
      --optional)
          # file to be copied is optional
          optional=1
          # remove argument as this is no rcp commandline param.
          arg=
          ;;
      --)
          # it is the last option
          lastOpt=1
          ;;
      -*)
          # other options, do nothing
          :
          ;;
      *)
         # not an option
         break
         ;;
      esac
      # process the option
      shift
      [[ -z \"\${arg}\" ]] || set -A opts -- \"\${op...@]}\" \"\${arg}\"
  done
  # now all options are removed from \"\...@\"

  # process parameters
  while (( \$# > 0 )) ; do
    arg=\"\$1\"
    shift

    userAndHost=\$(expr match \"\$arg\" '\\([^:/]*:\\)' || :)
    if [[ -n \"\$userAndHost\" ]] ; then
      user=\$(expr match \"\$userAndHost\" '\\([...@]*@\\)' || :)
      user=\"\${us...@}\"
      host=\"\${userandhos...@}\"
      host=\"\${host%:}\"
      if _fg_isLocal \"\$host\" && _fg_isCurrentUser \"\$user\" ; then
        arg=\"\${arg#*:}\"
        arg=\"\$(_fg_makeAbsolutePath \"\$arg\" \"\$HOME\")\"
        set +f
        IFS=''
        set -A argsTmp -- \${arg%/}
        IFS=\"\$ifsSaved\"
        eval \"\$(_fg_setShellFlags)\"
        set -A args -- \"\${ar...@]}\" \"\${argst...@]}\"
        continue
      fi
    fi
    arg=\"\${arg%/}\"
    set -A args -- \"\${ar...@]}\" \"\${arg}\"
  done
  # now all parameters are stored in \$ar...@]

  _fg_setRCP

  # process the parameters. there is a bug in the Linux (and IRIX?)
implemetation of rcp,
  # To avoid this bug, we do not use the rcp OPTIONS FILE FILE ... DIR
form of rcp.
  # We also avoid pure local copies, because these might fail silently
  # Another thing: Unfortunately we must quote SPACE, TAB, ''', '\"',
'\`', '\$', '#', '!' and '\\' with '\\'
  # The LINEFEED char doesn't work at all.
  if (( 1 == 1 )) ; then
    # test for a local target
    target=\"\${args[\${#ar...@]}-1]}\"
    if expr \"\$target\" : '\\([^:/]*:\\)' >/dev/null ; then
      if expr \"\$target\" : '.*
' >/dev/null ; then
        _fg_Error \"_fg_RCP \" \"\${op...@]}\" \"\$src\" \"\$target\" \"
Illegal character LF (0x0a) in target file name.\"
        return 1
      fi
      userAndHost=\"\${target%%:*}\"
      file=\"\${target#*:}\"
      # quote SPACE, TAB, \"'\", '\"', '\`', '\$', '#', '!' and '\\'
      target=\"\$(print -r -- \"\$target\" | sed -e \"\$sedCmd\")\" #
note the TAB!
    else
      targetIsLocal=1
    fi
    set -- \"\${ar...@]}\"
    while (( \$# > 1 )) ; do
      srcIsLocal=0
      src=\"\$1\"
      if expr \"\$src\" : '\\([^:/]*:\\)' >/dev/null ; then
        # source is remote
        if expr \"\$src\" : '.*
' >/dev/null ; then
          _fg_Error \"_fg_RCP \" \"\${op...@]}\" \"\$src\" \"\$target\" \"
Illegal character LF (0x0a) in source file name.\"
          return 1
        fi
        # quote SPACE, TAB, \"'\", '\"', '\`', '\$', '#' ,'!' and '\\'
        src=\"\$(print -r -- \"\$src\" | sed -e \"\$sedCmd\")\" # note the TAB!
      else
        srcIsLocal=1
      fi

      rcpCmd=\"\$RCP\"
      retryCmd=\"\"
      if [[ \"\$rcpCmd\" != *scp* ]] && \\
        (( targetIsLocal == 0 )) && (( srcIsLocal == 0 )) ; then
        rcpCmd=\"\$rcpCmd\"
        retryCmd=\"\$retryCmd\"
        _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 \"on host
\${userAndHost}: \" \$retryCmd \$rcpCmd \"\${op...@]}\" \"\$src\"
\"\$file\"
        \$retryCmd _fg_RExec -n \"\$userAndHost\" \$rcpCmd
\"\${op...@]}\" \"\$src\" \"\$file\"
        err=\$?
      else
        quotedtarget=\"\$target\"
        if (( targetIsLocal == 0 )) || (( srcIsLocal == 0 )) ; then

          if (( targetIsLocal == 0 )) && (( srcIsLocal == 0 )) ; then
            quotedtarget=\"\\\"\${quotedtarget}\\\"\"
          fi
        else
          # pure local case
          retryCmd=\"\"
          rcpCmd=\"cp\"
        fi
        _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 \$retryCmd \$rcpCmd
\"\${op...@]}\" \"\$src\" \"\$quotedtarget\"
        \$retryCmd \$rcpCmd \"\${op...@]}\" \"\$src\" \"\$quotedtarget\"
        err=\$?
      fi
      if (( \$optional == 1 )) && (( \$err != 0 )); then
         _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 \"Copy of optional file
'\$src' failed, may be it does not exist!\"
      fi
      (( \$err == 0 )) || return \$err
      shift
    done
  else
    # once the Linux rcp problem is fixed
    _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 \$RCP \"\${op...@]}\" \"\${ar...@]}\"
    \$RCP \"\${op...@]}\" \"\${ar...@]}\" && :
  fi
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_retry" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_retry_code=\
"

{
  typeset -i count=\"\$1\" ; shift
  typeset sleepTime=\"\$1\" ; shift
  typeset -i retval
  \"\...@\" && return 0
  retval=\$?
  while (( count > 0 )) ; do
    _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 \"_fg_retry: got exit code
\${retval}, will retry \${count} times after \${sleepTime} seconds:
\...@\"
    let 'count=count-1'
    sleep \$sleepTime
    \"\...@\" && return 0
    retval=\$?
  done
  _fg_Log \$_fg_LOG_FUNCTION_INTERALS2 \"_fg_retry: giving up: \...@\"
  return \$retval
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



fi




if [[ "x${__FLOWGUIDE_STATUS_FUNCTIONS_DEFINED__:-}" = "x" ]] ; then
__FLOWGUIDE_STATUS_FUNCTIONS_DEFINED__=1





# $1: original WfStatusInfo
# $2: element to replace
# $3 ... : new value. If omitted, the element is removed

_fg_generateFunctionImplementation --defineVars "_fg_modifyStatusString" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_modifyStatusString_code=\
"

{
  typeset l1='<?xml version=\"1.0\" encoding=\"iso-8859-1\"
standalone=\"yes\"?>'
  typeset l2='<fg:WfStatusInfo
xmlns:fg=\"http://www.science-computing.de/products/flowguide/xmlns/rel_1_0/WfStatusInfo.dtd
xmlns=\"http://www.science-computing.de/products/flowguide/xmlns/rel_1_0/WfStatusInfo.dtd\";>'
  typeset l99='</fg:WfStatusInfo>'

  typeset orig=\"\${1:-\$( print -r \"\$l1\" ; print -r \"\$l2\" ;
print -r \"\$l99\")}\"
  shift
  typeset elem=\"\${1}\"
  shift
  typeset line=''
  typeset inItem=0
  typeset ifsOrig=\"\$IFS\"

  set -f
  IFS='
'
  for line in \$orig; do
    IFS=\"\$ifsOrig\"
    if [ \$inItem -eq 0 ] ; then
      if [ \"X\$line\" = \"X<fg:Item name=\\\"\${elem}\\\">\" ] ; then
        inItem=1
      elif [ \"X\$line\" = \"X\$l99\" ] ; then
        inItem=0
        if [ \$# -gt 0 ] ; then
          print -r \"<fg:Item name=\\\"\${elem}\\\">\"
          print -r \"\$*\"
          print -r \"</fg:Item>\"
        fi
        print -r \"\$l99\"
      else
        print -r \"\$line\"
      fi
    else
      if [ \"X\$line\" = \"X</fg:Item>\" ] ; then
        inItem=0
      fi
    fi
  done
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null


# $1 key,
# $2... value

_fg_generateFunctionImplementation --defineVars "_fg_updateStatus" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_updateStatus_code=\
"

{
  [[ \"xdisabled\" = \"xdisabled\" ]] ||
\${_fg_UpdateStatusFunctionName:-\":\"} \"\...@\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null


# $1 Name of the update status function

_fg_generateFunctionImplementation --defineVars "_fg_setUpdateStatusFunction" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_setUpdateStatusFunction_code=\
"

{
_fg_UpdateStatusFunctionName=\"\${1:-\":\"}\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null


# Report the Change of an (sub)-Workflow state
# $1: WfName
# $2: WfFullName
# $3: oldState
# $4: condition
# $5: newStateSuccess
# $6: newStateFailed

_fg_generateFunctionImplementation --defineVars "_fg_reportWfState" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_reportWfState_code=\
"

{
  typeset newState=\"\$6\"
  typeset timestamp=\"\$(LC_ALL=POSIX date -u +%y%m%d_%H%M%S)\"
  if (( \$4 == 0 )) ; then
    newState=\"\$5\"
  fi

  _fg_updateStatus \"WfState.\$2.\$newState\" \"<WfStatusChange
fn=\\\"\$2\\\" old=\\\"\$3\\\" new=\\\"\$newState\\\"
date=\\\"\${timestamp}\\\" />\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



fi


# get the jobid for this job
# the form of the jobid differs betwen normal jobs and jobs,
# which are part of an job array

_fg_generateFunctionImplementation --defineVars "_fg_set_fg_LsfJobId" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_set_fg_LsfJobId_code=\
"

{
  if [[ \"x\${LSB_JOBINDEX:-}\" = \"x0\" || \"x\${LSB_JOBINDEX:-}\" =
\"x\" ]] ; then
    : \${_fg_LsfJobId:=\"\${LSB_JOBID}\"}
  else
    : \${_fg_LsfJobId:=\"\${LSB_JOBID}[\${LSB_JOBINDEX}]\"}
  fi
  : \${_fg_BatchJobId:=\"\${_fg_LsfJobId}\"} # a more general variable.
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null


_fg_set_fg_LsfJobId

# get the execution hosts for this job

_fg_generateFunctionImplementation --defineVars
"_fg_set_fg_BatchExecutionHosts" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_set_fg_BatchExecutionHosts_code=\
"

{
  _fg_isDefinedVar _fg_BatchExecutionHosts || set -A
_fg_BatchExecutionHosts -- \${LSB_HOSTS}
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null


_fg_set_fg_BatchExecutionHosts

# Update the status of a workflow executed by LSF
# $1 key,
# $2... value

_fg_generateFunctionImplementation --defineVars "_fg_updateLSFStatus" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_updateLSFStatus_code=\
"

{
  typeset statusFile=\".WfStatusInfo.xmllsf\"
  typeset lsfMessageIndex=\"1\"
  typeset lsfDescription=\"FgWfStatusInfo\"
  typeset -i sleeptime=\"10\"
  typeset oldStatus=\"\${_fg_LsfWfStatusInfo:-}\"
  typeset -i index=\${_fg_LsfWfStatusIndex:-0}

  if [[ \"X\$1\" = \"X--fast\" ]] ; then
        shift
        _fg_LsfWfStatusInfo=\"\$(_fg_modifyStatusString
\"\$oldStatus\" \"\...@\")\"
  else
        _fg_LsfWfStatusInfo=\"\$(_fg_modifyStatusString
\"\$oldStatus\" \"\...@\")\"

        # update the content of the status file in an atomic transaction
        print -r -- \"\$_fg_LsfWfStatusInfo\" >\"\${statusFile}.new\"
        mv -f \"\${statusFile}.new\" \"\${statusFile}\"

        # create a wait file and delay the bpost for a few seconds
        # this way we call bpost at most every \$sleeptime seconds
        if [[ ! -a \"\${statusFile}.wait\" ]] ; then
          : >\"\${statusFile}.wait\"
          let \"index=index+1\"
          _fg_LsfWfStatusIndex=\$index
          (
          sleep \"\$sleeptime\"
          rm -f \"\${statusFile}.wait\"
          [[ -r \"\${statusFile}\" ]] && bpost -i
\"\$lsfMessageIndex\" -d \"\$lsfDescription \$index\" -a
\"\${statusFile}\" \"\$_fg_LsfJobId\" && :
          ) </dev/null &
        fi
  fi
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_reportPidToFlowguide" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_reportPidToFlowguide_code=\
"

{
    :
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null


_fg_setUpdateStatusFunction _fg_updateLSFStatus


   TMPDIR="/tmp/caejobs/qx04803/ABAQUS/BMW/flowguide/abaqus/20070813_154320"
   TMPDIR="${TMPDIR:-/tmp/$(_fg_makeSaneFileName
"lsf.$USER.$LSB_JOBNAME.$_fg_LsfJobId")}"
    ### BEGIN source code for creating the target directory

    if [ ! -d "$TMPDIR" ]; then
       mkdir -p "$TMPDIR"
       if [ $? -ne 0 ]; then
          echo " $TMPDIR could not be created. Abort"
          exit 1
       fi
    fi

    ### END source code for creating the target directory

   cd "$TMPDIR"

if [[ "x" != "xdisabled" ]] ; then
   _fg_LsfFileForReportingCWD="$(_fg_mapWinPath2Unix
"/home/XXXXX/.flowguide/UNIX/PID/${_fg_LsfJobId}.lsfid" || :)"

   pwd >"$_fg_LsfFileForReportingCWD" || :
   chmod 644 "$_fg_LsfFileForReportingCWD" || :
fi

_fg_setLOCAL_HOST
_fg_updateStatus --fast jobhost "<c><![CDATA[${LOCAL_HOST_LONG%:}]]></c>"
_fg_updateStatus jobcwd "<c><![CDATA[$(pwd)]]></c>"
#!/bin/ksh



: "${EXITVAL:=0}"

#
# generated by flowGuide
#



test true = true && :
_fg_reportWfState "TransferToFS" \
"24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS"
\
"Ready" "$?" \
"Running" \
""
# on activate

if [ true = true ]; then
#
#####  start wf ShellScriptFunctions ####
#


test true = true && :
_fg_reportWfState "ShellScriptFunctions" \
"24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS.ShellScriptFunctions"
\
"Ready" "$?" \
"Running" \
""
# on activate

if [ true = true ]; then
#
#####  start wf WfCmdLineAtomic_inst ####
#


test true = true && :
_fg_reportWfState "WfCmdLineAtomic_inst" \
"24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS.ShellScriptFunctions.WfCmdLineAtomic_inst"
\
"Ready" "$?" \
"Running" \
""
#!/bin/ksh

WORKING_DIR="."

if [ -n "${WORKING_DIR}" ]; then
        cd "${WORKING_DIR}" || exit 99
fi

set +efx

if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
  print -r -- "${PS4}# CodeForExecutingCommand: start of environment
code" 1>&"$_fg_functionStderrHandle"
fi
if (( $_fg_debug & $_fg_DEBUG_APPLICATION_EXECUTION )) ; then
  set -x
else
  if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
    print -r -- "${PS4}# CodeForExecutingCommand: debugging turned off
for environment code" 1>&"$_fg_functionStderrHandle"
  fi
fi

FG_LOGDIR="/home/XXXXX/.flowguide/UNIX/LOGS"
FG_WF_LOGFILE="null.AbaqusRestart_param_070813_154313.log"
FG_SUBWF_LOGFILE="24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS.ShellScriptFunctions.WfCmdLineAtomic_inst"

export  FG_LOGDIR FG_WF_LOGFILE FG_SUBWF_LOGFILE


set +x
if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
  print -r -- "${PS4}# CodeForExecutingCommand: end of environment
code." 1>&"$_fg_functionStderrHandle"
  set -x
fi




_fg_generateFunctionImplementation --defineVars "_fg_reportPidToFlowguide" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_reportPidToFlowguide_code=\
"

{
    echo \$\$ >> /home/XXXXX/.flowguide/UNIX/PID/\${FG_SUBWF_LOGFILE%.log}.pid
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null


_fg_reportPidToFlowguide

set +x
if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
  print -r -- "${PS4}# CodeForExecutingCommand: start of application
code" 1>&"$_fg_functionStderrHandle"
fi
if (( $_fg_debug & $_fg_DEBUG_APPLICATION_EXECUTION )) ; then
  set -x
else
  if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
    print -r -- "${PS4}# CodeForExecutingCommand: debugging turned off
for application code" 1>&"$_fg_functionStderrHandle"
  fi
fi

:

eval "
#IIS InsertInScript
/share/xxx/flowguide/1.4/INDEP/../workflows/bmw_default/templates/ksh/lib/header.ksh
#!/bin/ksh

PATH=\"\${PATH}:/usr/local/bin:/bin:/usr/bin:/usr/bsd:/usr/local/lsf/bin\"

which banner >/dev/null 2>&1
bannerExist=\$?
if [ \$bannerExist -eq 0 ]; then
    banner \`hostname\`
else
    echo \"==================================================================\"
    echo  HOST: \`hostname\` \\(\$OSTYPE\\)
    echo \"==================================================================\"
fi

echo \"Report file size limit:\"
ulimit -a
echo

##@ enter local modifications here
################################################## science + computing gmbh ###
###
### eine kleine Mail an den Benutzer nach Abschluss des Joblaufs
###
####################################### LAST CHANGE: 12.07.04 ####### sw at s+c 
##
shGenerateMail () {
  typeset sub=shGenerateMail
  typeset TIME_OF_REPORT=\`date\`
  typeset WSUID=\$USER
  typeset TEXT=
  typeset POSTSCRIPTUM=
  typeset SUBJECT=\"JOB <\$LSB_JOBNAME> : Fertig\"
  typeset size=0

  typeset fs_dir=\"\$FS_DIR\"
  typeset ws_data=\"\$WS_DATA\"
  typeset os_sep='/'
  if [ \"x\$WINDOWS_SUBMIT\" = \"xtrue\" ]; then
     fs_dir=\"\$FS_DIR_WIN\"
     ws_data=\"\$WS_DATA_WIN\"
     os_sep='\\\\'
     POSTSCRIPTUM=\"
PS:
Be aware of the fact that in case your result folder is on a local
disk it is not possible to transfer all the results back to this
folder only result folders on the L drive are reachable from the UNiX
compute server!
\"
  fi
  fs_dir=\`print -R \"\${fs_dir}\" | sed -e 's/ /%20/g'\`
  ws_data=\`print -R \"\${ws_data}\" | sed -e 's/ /%20/g'\`
  # HTTP_FILE is a list of file extensions set by the configuration (.cfg)
  for ext in \$HTTP_FILES; do
      http_file=\"\${MODELNAME}\${ext}\"
      if [ -f \${http_file} ]; then
        TEXT=\"\${TEXT}file:\${ws_data}\${os_sep}\${http_file} \"
      fi
  done
#  [ \$RESCUE_SAVE -gt 0 ] && \\
#  TEXT=\"\$TEXT
#Some of your data have been saved on:
#\$HOST:\$LOCAL_BACKUP
#\"


  echo Sending mail with subject: \"\${SUBJECT}\" to: \"\$WSUID\"
  env TMPDIR=/tmp mailx -s \"\${SUBJECT}\" \$WSUID <<EOM
Job <\$LSB_JOBNAME> was submitted from host <\$WS> by user <\$WSUID>.

The \$BATCH_SYSTEM Batch job ID was <\$LSB_JOBID>.

file:\${fs_dir}
    is used as the output directory on the Fileserver.
file:\${ws_data}
    is used as the working directory on the submit host <\$WS>.

\${LSB_LOGFILE}
    the standard output and error of the jobs are appended to this file.

Job was finished at \$TIME_OF_REPORT.


\$TEXT
\$POSTSCRIPTUM
EOM

  # sleep necessary due to problems with sending mails in SGE-Jobs!
  sleep 3
}


createPCTransfScript() {
  typeset pc_script=\$1; shift
  typeset os_sep='\\'
  typeset srcfile
  typeset tgtfile

  print -R \"@echo off\" > \$pc_script
  print -R \"REM copy script generated by flowguide.\" >> \$pc_script
  print -R \"echo.\" >> \$pc_script
  print -R \"cd \${WS_DATA_WIN}\" >> \$pc_script
  print -R \"if ERRORLEVEL 1 goto ERROR1\" >> \$pc_script
  print -R \"echo Copying resultfiles back to the PC ...\" >> \$pc_script
  for srcfile in \$OUTPUTFILES; do
    # OUTPUTFILES elements stored as: srcfilename/targetfilename
    tgtfile=\`basename \$srcfile\`
    srcfile=\`dirname \$srcfile\`
    tgtfile=\"\${WS_DATA_WIN}\${os_sep}\${tgtfile}\"
    srcfile=\"\${FS_DIR_WIN}\${os_sep}\${srcfile}\"
    print -R \"echo Copying \${srcfile} ...\" >> \$pc_script
    print -R 'copy \"'\${srcfile}'\" \"'\${tgtfile}'\"' >> \$pc_script
    print -R \"if ERRORLEVEL 1 (\" >> \$pc_script
    print -R \"  echo An error occured while copying result file -
probably it is an optional file. Trying next file.\" >> \$pc_script
    print -R \"  echo.\" >> \$pc_script
    print -R \")\" >> \$pc_script
  done
  echo \"echo Copying results from fileserver has been finished.\" >>
\$pc_script
  print -R 'dir /O:D \"'\${WS_DATA_WIN}'\"' >> \$pc_script
  print -R \"pause\" >> \$pc_script
  print -R \"exit\" >> \$pc_script
  print -R \":ERROR1\" >> \$pc_script
  print -R \"echo May not access result folder:\" >> \$pc_script
  print -R \"echo \${WS_DATA_WIN}\" >> \$pc_script
  print -R \"echo No copy possible. Abort!\" >> \$pc_script
  print -R \"pause\" >> \$pc_script
}


shGenerateFetchMail () {
  typeset sub=shGenerateFetchMail
  typeset TIME_OF_REPORT=\`date\`
  typeset WSUID=\$USER
  typeset SUBJECT=\"JOB <\$LSB_JOBNAME> : Fetch results from fileserver\"
  typeset 
pc_script_win=\"L:\\\\home\\\\\$USER\\\\.flowguide\\\\scripts\\\\fg_pc_\${LSB_JOBID}.bat\"
  typeset pc_script=\"\$(_fg_mapWinPath2Unix \$pc_script_win)\"

  typeset fs_dir=\"\$FS_DIR\"
  typeset ws_data=\"\$WS_DATA\"
  typeset os_sep='/'
  if [ \"x\$WINDOWS_SUBMIT\" = \"xtrue\" ]; then
     fs_dir=\"\$FS_DIR_WIN\"
     ws_data=\"\$WS_DATA_WIN\"
     os_sep='\\\\'
  fi
  print -R \"fs_dir: \${fs_dir}\"
  fs_dir=\`print -R \"\${fs_dir}\" | sed -e 's/ /%20/g'\`
  ws_data=\`print -R \"\${ws_data}\" | sed -e 's/ /%20/g'\`

  createPCTransfScript \$pc_script
  echo Sending mail with subject: \"\${SUBJECT}\" to: \"\$WSUID\"
  env TMPDIR=/tmp mailx -s \"\${SUBJECT}\" \$WSUID <<EOM
Dear user,

Your Job <\$LSB_JOBNAME> submitted from host <\$WS> by user <\$WSUID>
has finished now. All results have been copied to the Fileserver:
file:\${fs_dir}

You now may transfer all these results back to your PC by running the
following script:

file:\${pc_script_win}

Finally, all your results will be copied back to your PC into:
file:\${ws_data}


In case of problems please send an email to:
mailto:flowguide-bmw at science-computing.de

This email has been created automatically by FlowGuide (tm).
EOM
}


################################################## science + computing gmbh ###
###
### email in case an error occured.
### getdata, solver, putdata, rescuedata
####################################### LAST CHANGE: 25.06.04 ###### sw at s+c 
###

shGenerateErrorMail () {
  typeset sub=shGenerateErrorMail
  typeset WSUID=\$USER
  typeset links=
  typeset rescue=
  typeset errtxt=
  typeset wsls=\`_fg_RSH \$WS \"cd \$WS_DATA && ls -al\"\`
  typeset fsls=\`_fg_RSH \$FS \"cd \$FS_DIR && ls -al\"\`
  typeset dirlists=\"
To get an idea why the transfer failed the following directory listings
have been appended. They show the actual situation:

(1) LSF-Workingdirectory: \`pwd\`
\`ls -al\`

(2) workstation directory: \$WS_DATA
\$wsls

(3) fileserver directory: \$FS_DIR
\$fsls
\"

  typeset TIME_OF_REPORT=\`date\`
  typeset SUBJECT=\"JOB <\$LSB_JOBNAME> : failed\"

  case \$1 in
  getdata):
    SUBJECT=\"\$SUBJECT while transferring input files\"
    errtxt=\"
The transfer of input file \$FILEFAILED failed!
As this file is mandatory for your calculations the job aborted now!

\$dirlists
\"
    ;;
  solver):
    SUBJECT=\"\$SUBJECT due to solver error\"
    if [ -r \${MODELNAME}.LOG ]; then
        errtxt=\"
Your solver sent the following error messages:
\`cat \${MODELNAME}.LOG\`\"
    else
        errtxt=\"
Your solver had some problems, please consult the solver-specific logfiles
\"
    fi
    errtxt=\"\$errtxt

Your job is (still) transfering all result files.
\"
    ;;
  putdata):
    SUBJECT=\"\$SUBJECT while transferring result files\"
    #errtxt=\"The following files had some problems during copy back
to \$WS_DATA
#\$FILEFAILED
errtxt=\"Some files had some problems during copy back to \$WS_DATA

Probably
a) the host \$WS was unreachable
b) the disk was full
For more information you have to look into the log-file:
\${LSB_LOGFILE}

\$dirlists
\"
    ;;
  rescuedata):
    SUBJECT=\"\$SUBJECT while transferring result files\"
    errtxt=\"While copying the result data some problem had accoured.
Some of your data have been saved on:
\"
    typeset host
    for host in \${LSB_HOSTS}; do
        errtxt=\"\$errtxt
\$host:\${LOCAL_BACKUP}\"
    done
    errtxt=\"
\$errtxt
\$dirlists
\"


    ;;
  esac

  # HTTP_FILE is a list of file extensions set by the configuration (.cfg)
  for ext in \$HTTP_FILES; do
      http_file=\"\${MODELNAME}\${ext}\"
      if [ -f \${http_file} ]; then
        errtext=\"\${errtext}
file:\${WS_DATA}/\${http_file}\"
      fi
  done


  typeset fs_dir=\"\$FS_DIR\"
  typeset ws_data=\"\$WS_DATA\"
  typeset os_sep='/'
  if [ \"x\$WINDOWS_SUBMIT\" = \"xtrue\" ]; then
     fs_dir=\"\$FS_DIR_WIN\"
     ws_data=\"\$WS_DATA_WIN\"
     os_sep='\\\\'
  fi
  fs_dir=\`print -R \"\${fs_dir}\" | sed -e 's/ /%20/g'\`
  ws_data=\`print -R \"\${ws_data}\" | sed -e 's/ /%20/g'\`
  echo \"Sending error-mail to: '\$WSUID' with subject: '\${SUBJECT}'\"

  env TMPDIR=/tmp mailx -s \"\${SUBJECT}\" \$WSUID <<EOM
Job <\$LSB_JOBNAME> was submitted from host <\$WS> by user <\$WSUID>.
The \$BATCH_SYSTEM Batch job ID number was <\$LSB_JOBID>.

file:\${fs_dir}
    is used as the output directory on Fileserver.
file:\${ws_data}
    is used as the working directory on local host <\$WS>.


The standard output and error of the jobs are appended to:
\$LSB_LOGFILE.

\$links
Job aborted at \${TIME_OF_REPORT}.
===============================================================================

\$errtxt

EOM

### set +x
}

"


_fg_AR="$?"
set +x
if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
  print -r -- "${PS4}# CodeForExecutingCommand: end of application
code. exit code: $_fg_AR" 1>&"$_fg_functionStderrHandle"
  set -x
fi
eval "$(_fg_setShellFlags "$_fg_AR")" && :
EXITVAL="$?"
#Set the specified accepted exit values to 0
if [ "$EXITVAL" = "0" ]; then
EXITVAL="0"
elif [ "$EXITVAL" = "0" ]; then
EXITVAL="98"
fi


test "$EXITVAL" = "0" && :
_fg_reportWfState "WfCmdLineAtomic_inst" \
"24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS.ShellScriptFunctions.WfCmdLineAtomic_inst"
\
"Running" "$?" \
"Done" \
"ClosedFailed"
#
#####    end of WfCmdLineAtomic_inst ####
#

fi


test "$EXITVAL" = "0" && :
_fg_reportWfState "ShellScriptFunctions" \
"24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS.ShellScriptFunctions"
\
"Running" "$?" \
"Done" \
"ClosedFailed"
#
#####    end of ShellScriptFunctions ####
#

fi
if [ "$EXITVAL" = "0" ]; then
#
#####  start wf BasicCopy1 ####
#


test true = true && :
_fg_reportWfState "BasicCopy1" \
"24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS.BasicCopy1"
\
"Ready" "$?" \
"Running" \
""



CP="cp"
RCP="scp -oBatchMode=yes -oForwardX11=no"
RSH="ssh"
SOURCE_HOST="caefl06.muc:"
DEST_HOST="sphsm.muc:"

_fg_setLOCAL_HOST

[ "$SOURCE_HOST" = ":" ] && SOURCE_HOST="$LOCAL_HOST"
[ "$DEST_HOST" = ":" ] && DEST_HOST="$LOCAL_HOST"


_fg_setRSH
if [[ "x${__FLOWGUIDE_FILEDELIVERY_FUNCTIONS_DEFINED__:-}" = "x" ]] ; then
__FLOWGUIDE_FILEDELIVERY_FUNCTIONS_DEFINED__=1





_fg_generateFunctionImplementation --defineVars "_fg_RemoteWildcardExpand" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_RemoteWildcardExpand_code=\
"

{
  typeset i=\"\$IFS\"

  typeset debugOn
  if (( \${_fg_RemoteWildcardExpand_debug:-\${_fg_debug}} &
_fg_DEBUG_FUNCTION_REXEC )) ; then
    debugOn=\"PS4=\\\"\${PS4}<REMOTE> + \\\" ; set -x ; \"
  fi

  set -f
  IFS=\"\$(print -n '\\01')\"
  set -A _fg_AR -- \$( print -r - \"\${debugOn}IFS=''
       set -- \\\$1
       set -f
       if [[ -a \\\"\\\${1}\\\" ]] ; then
         IFS='\$IFS'
         print -nr - \\\"\\\$*\\\"
       fi
\" | _fg_RemoteScript -n \"\$1\" \"\$2\" )
  IFS=\"\$i\"
  eval \"\$(_fg_setShellFlags \$?)\" && :
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_RemoteFileExists" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_RemoteFileExists_code=\
"

{
  _fg_RemoteWildcardExpand \"\$1\" \"\$2\"  # sets _fg_AR
  test \${#_fg_...@]} -ne 0
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_CreateRemoteScript" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_CreateRemoteScript_code=\
"

{
  typeset name
  typeset requiredNames
  typeset vardef
  typeset vardefitem
  typeset vardeftmp
  while expr \"\$1\" : '[A-Za-z0-9_]*=' >/dev/null ; do
     eval \"overwrite\${1%%=*}=\\\"\\\${1#*=}\\\"\"
     shift
  done

  requiredNames=\"\$(_fg_ResolveRequires 0 \"\...@\" \\
  _fg_SETUP_bootstrap _fg_setShellFlags | sort | uniq)\"
  for name in \$requiredNames ; do
    if _fg_isDefinedVar \"\$name\" ; then
        # export the var
        set -f
        vardef=\"\$(typeset | _fg_Sane grep '^\\(.* \\)\\{0,1\\}'\${name}'\$')\"
        [[ \"\${vardef%% *}\" = \"typeset\" ]] || {
          if [[ -z \"\${vardef}\" ]]; then
            vardef=\"typeset \${name}\"
          else
            vardeftmp=\"typeset\"
            for vardefitem in \${vardef} ; do
              case \"\${vardefitem}\" in \\
                export)
                  vardeftmp=\"\${vardeftmp} -x\"
                  ;;
                integer)
                  vardeftmp=\"\${vardeftmp} -i\"
                  ;;
                readonly)
                  vardeftmp=\"\${vardeftmp} -r\"
                  ;;
                *)
                  vardeftmp=\"\${vardeftmp} \${vardefitem}\"
                  ;;
              esac
            done
            vardef=\"\${vardeftmp}\"
          fi
        }
        print -rn -- \"\${vardef}='\"
        eval \"print -rn --
\\\"\\\${overwrite\${name}-\\\${\${name}}}\\\"\" | \\
        LC_ALL=POSIX perl -pe \"s/'/'\\\"'\\\"'/g\"
        print -r -- \"'\"
    elif _fg_isDefined \"\$name\" ; then
      : # do nothing
    else
        _fg_Error _fg_CreateRemoteScript \"Name \$name is not defined.
Fix your templates!\"
        return \$?
    fi
  done
  print -r -- 'eval \"\$_fg_SETUP_bootstrap\"
_fg_generateFunctionImplementation _fg_getFunctionInitCode </dev/null
_fg_generateFunctionImplementation _fg_debugFunctionInit </dev/null'

  for name in \$requiredNames ; do
    if _fg_isDefined \"\$name\" ; then
        eval \"unset DONE_fg_ResolveRequires_\${name} || :\" || :
        case \"\$name\" in _fg_getFunctionInitCode|_fg_debugFunctionInit)
            ;;
        *)
            print -r -- \"_fg_generateFunctionImplementation \$name </dev/null\"
            ;;
        esac
    fi
  done
  print -r -- 'eval \"\$(_fg_setShellFlags)\"'

  print -r -- \"# end of functions, user defined code follows\"
  dd 2>/dev/null
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null




_fg_generateFunctionImplementation --defineVars "_fg_ResolveRequires" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_ResolveRequires_code=\
"

{
  typeset -i recursion=\"\$1\" ; shift
  if (( recursion > 10 )) ; then
    _fg_Error _fg_ResolveRequires \"infinite recursion detected! Fix
your templates\"
    return \$?
  fi
  let recursion=recursion+1

  typeset name
  typeset requires
  set -f
  for name ; do
    if _fg_isDefinedVar \"\$name\" ; then
        print -r -- \"\$name\"
        if expr \"\${name}\" : \".*_bootstrap\$\" >/dev/null ; then
           _fg_ResolveRequires \${recursion} \$(eval \"print -r --
\\\"\\\${\${name}}\\\"\" | _fg_AnalyzeCodeForRequires \"\$name\" )
        fi
    elif _fg_isDefined \"\$name\" && _fg_isDefinedVar \"\${name}_code\"; then
      if eval \"[[ -z \\\"\\\${DONE_fg_ResolveRequires_\${name}:-}\\\"
]]\" ; then
        eval \"DONE_fg_ResolveRequires_\${name}=1\"
        print -r -- \"\$name\"
        print -r -- \"\${name}_code\"
        if _fg_isDefinedVar \"\${name}_debug\" ; then
           print -r -- \"\${name}_debug\"
        fi
        if _fg_isDefinedVar \"\${name}_logFlags\" ; then
           print -r -- \"\${name}_logFlags\"
        fi
        if _fg_isDefinedVar \"\${name}_noWrapper\" ; then
           print -r -- \"\${name}_noWrapper\"
        fi
        if _fg_isDefinedVar \"\${name}_requires\" ; then
           print -r -- \"\${name}_requires\"
        fi
        eval \"requires=\\\"\\\${\${name}_requires:-AUTO}\\\"\"
        if [[ \"\${requires%% *}\" = \"AUTO\" ]] ; then
            requires=\"\$(eval \"print -r --
\\\"\\\${\${name}_code}\\\"\" | _fg_AnalyzeCodeForRequires \"\$name\"
) \${requires#AUTO}\"
        fi
        if [[ -n \"\$requires\" ]] ; then
            _fg_ResolveRequires \${recursion} \${requires}
        fi
      fi
    fi
  done
  eval \"\$(_fg_setShellFlags)\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_AnalyzeCodeForRequires" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_AnalyzeCodeForRequires_code=\
"

{
  typeset name=\"\$1\" ; shift
  LC_ALL=POSIX perl -pe 'tr/A-Za-z0-9_/\\n/cs' | \\
  LC_ALL=POSIX perl -ne 'next unless /^_fg_/ ;
next if /^_fg_AR\$/;
next if /^_fg_.*_debug\$/;
next if /^'\${name}'\$/;
print ; ' | sort | uniq
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null




_fg_generateFunctionImplementation --defineVars "_fg_Xargs" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_Xargs_code=\
"

{
  set -A _fg_AR -- '-E' ''
  _fg_Sane xargs \"\${_fg_...@]}\" < /dev/null 2>/dev/null || set -A
_fg_AR -- '-e'
  _fg_Sane xargs \"\${_fg_...@]}\" \"\...@\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars "_fg_RemoteXargs" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_RemoteXargs_code=\
"

{
  exec 8<&0
  _fg_CreateRemoteScript \"_fg_Xargs\" <<'EOF' | _fg_RemoteScript \"\...@\"
# change into the right directory
cd \"\$1\" || return \$? ; shift
_fg_Xargs \"\...@\"
EOF
  typeset -i retval=\"\$?\"
  exec 8<&-
  return \$retval
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null




_fg_generateFunctionImplementation --defineVars "_fg_RemoteFind" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_RemoteFind_code=\
"

{
  exec 8<&0
  _fg_ExecRemotePerl -n \"\...@\" <<'EOF'
use File::Find;
chdir(shift(@ARGV)) or die \"Can't change directory: \$!\";
sub wanted {
  return if /^\\.\\.?\$/ or not -e ;
  \$_=\$File::Find::name;
  s/\\\\/\\\\\\\\/g;s/\\n/\\\\n/g;
  print \$_ ,\"=\\n\";
}
find(\\&wanted, at ARGV);
EOF
  typeset -i retval=\"\$?\"
  exec 8<&-
  return \$retval
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null




_fg_generateFunctionImplementation --defineVars "_fg_FileDelivery" \
debug="" \
logFlags="259" \
requires="" \
noWrapper=""
_fg_FileDelivery_code=\
"

{
  # initialize some vars
  typeset ifsOrig=\"\$IFS\"
  typeset tid=\"\$(_fg_Sane date +%y%m%d_%H%M%S)\"
  typeset errorOccoured=0
  typeset defaultSourceHost=\"\$1\" ; shift
  typeset defaultDestinationHost=\"\$1\" ; shift
  typeset filesToRemove

  # variables used inside the while loop
  typeset arg
  typeset transfer
  typeset transferOptions
  typeset conversion
  typeset sourceHost
  typeset destinationHost
  typeset destinationFile
  typeset sourceFile
  typeset sourcePath
  typeset destinationPath
  typeset rmFlag
  typeset isRmImmediate
  typeset skipExisting
  typeset cpFlag
  typeset isOptional
  typeset ignoreErrors
  typeset isCritical
  typeset noOverwrite
  typeset cpOptions
  typeset rmOptions
  typeset cpFailed
  typeset unlinkDestination
  typeset trySymlink

  # tmp variables
  typeset sp
  typeset dp
  typeset host
  typeset flags
  typeset file
  typeset msg

  # save the positional parameters
  typeset fileList
  set -A fileList -- \"\...@\"


  # loop over the filelist
  ## work around a ast-ksh optimizer bug with eval '...'
  while eval '(( \${#fileli...@]} > 0 )) && :' ; do
    set -- \"\${fileli...@]}\"
    arg=\"\$1\"; shift
    set -A fileList -- \"\...@\"

    transfer=\"\${arg%%:*}\"
    arg=\"\${arg#*:}\"
    transferOptions=\"\${arg%%:*}\"
    arg=\"\${arg#*:}\"
    conversion=\"\${arg%%:*}\"
    arg=\"\${arg#*:}\"
    sourceHost=\"\${arg%%:*}\";
sourceHost=\"\${sourceHost:-\$defaultSourceHost}:\"
    arg=\"\${arg#*:}\"
    destinationHost=\"\${arg%%:*}\";
destinationHost=\"\${destinationHost:-\$defaultDestinationHost}:\"
    arg=\"\${arg#*:}\"
    destinationFile=\"\${arg##*/}\"
    arg=\"\${arg%/*}\"
    sourceFile=\"\${arg##*/}\"
    arg=\"\${arg%/*}\"
    sourcePath=\"\${arg%//:*}\"
    destinationPath=\"\${arg##*//:}\"

    # prepare some flags. Default is a copy operation
    rmFlag=0
    isRmImmediate=0
    skipExisting=0
    cpFlag=1
    isOptional=0
    ignoreErrors=0
    isCritical=0
    noOverwrite=0
    cpOptions=''
    rmOptions=''
    cpFailed=0
    unlinkDestination=0
    trySymlink=0

    [ \"\$sourceHost\" = \":\" ] && sourceHost=\"\$LOCAL_HOST\"
    [ \"\$destinationHost\" = \":\" ] && destinationHost=\"\$LOCAL_HOST\"

    case \"\$transfer\" in
      move|mv)
               rmFlag=1
               ;;
      immediateMove)
               rmFlag=1
               isRmImmediate=1
               isCritical=1
               ;;
      remove|rm)
                 cpFlag=0
                 rmFlag=1
                 ;;
    esac

    set -f
    IFS=\",\"
    set -- \$transferOptions
    IFS=\"\${ifsOrig}\"
    eval \"\$(_fg_setShellFlags)\"
    while (( \$# > 0 )) ; do
      case \"\$1\" in
        --optional)
                    isOptional=1
                    ;;
        --ignoreErrors)
                    ignoreErrors=1
                    isCritical=0
                    ;;
        --critical)
                    ignoreErrors=0
                    isCritical=1
                    ;;
        --immediateRm)
                    isRmImmediate=1
                    ;;
        --unlessTargetExists)
                    skipExisting=1
                    ;;
        --unlinkDestination)
                    unlinkDestination=1
                    ;;
        --trySymlink)
                    trySymlink=1
                    ;;
        -i)
            noOverwrite=1
            ;;
        -r)
            cpOptions=-r
            rmOptions=-r
        ;;
      esac
      shift
    done

    case \"\$conversion\" in
      ieee)
            : # to be implemented
            ;;
    esac

    if (( \$isOptional )) ; then
       if _fg_RemoteFileExists \"\${sourceHost%:}\"
\"\${sourcePath}/\${sourceFile}\" ; then
          : # do nothing
       else
          # ignore this FTD
          cpFlag=0
          rmFlag=0
          _fg_Log \$_fg_LOG_FUNCTION_INTERALS1 \"Optional file
'\${sourceHost}\${sourcePath}/\${sourceFile}' does not exist.
Operation skipped.\"
       fi
    fi

    if [ \"\$cpFlag\" -eq 1 ] ; then
      if [ \"\$noOverwrite\" -eq 1 ]; then
        if [ -n \"\$destinationFile\" ]; then
          _fg_RemoteFileExists \"\${destinationHost%:}\"
\"\${destinationPath}/\${destinationFile}\" && \\
           destinationFile=\${destinationFile}_\$tid
        else
          if [ \"\$cpOptions\" != \"-r\" ]; then
            _fg_RemoteFileExists \"\${destinationHost%:}\"
\"\${destinationPath}/\${sourceFile}\" && \\
             destinationFile=\${sourceFile}_\$tid
          else
            _fg_RemoteFileExists \"\${destinationHost%:}\"
\"\${destinationPath}\" && \\
             destinationPath=\${destinationPath%/}_\$tid
          fi
        fi
      elif [ \"\$skipExisting\" -eq 1 ]; then
        if [ -n \"\$destinationFile\" ]; then
          if _fg_RemoteFileExists \"\${destinationHost%:}\"
\"\${destinationPath}/\${destinationFile}\" ; then
            # ignore this FTD
            cpFlag=0
            rmFlag=0
            _fg_Log \$_fg_LOG_FUNCTION_INTERALS2 \"Destination file
'\${destinationHost}\${destinationPath}/\${destinationFile}' does
already exist. Operation skipped.\"
          fi
        else
          if [ \"\$cpOptions\" != \"-r\" ]; then
            if _fg_RemoteFileExists \"\${destinationHost%:}\"
\"\${destinationPath}/\${sourceFile}\" ; then
              # ignore this FTD
              cpFlag=0
              rmFlag=0
              _fg_Log \$_fg_LOG_FUNCTION_INTERALS2 \"Destination file
'\${destinationHost}\${destinationPath}/\${sourceFile}' does already
exist. Operation skipped.\"
            fi
          fi
        fi
      fi
    fi

    if [ \"\$cpFlag\" -eq 1 ] ; then
      if (( unlinkDestination == 1 )); then
        _fg_RemoteWildcardExpand \"\${sourceHost%:}\"
\"\${sourcePath}/\${sourceFile}\"
        _fg_RemoteFind \"\${sourceHost%:}\" \"\${sourcePath}\"
\"\${_fg_...@]}\" | \\
        sed -e \"s/[\\\"']/\\\\\\\\&/g; s/=\$//;\" | \\
        _fg_RemoteXargs \"\${destinationHost}\" \"\${destinationPath}\" rm -f
      fi

      _fg_remoteMakePath \"\${destinationHost%:}\" \"\${destinationPath}\"
      cpFailed=\$?
      if [ \"\$cpFailed\" -ne 0 -a \"\$ignoreErrors\" -eq 0 ] ; then
        _fg_Error \"Could not create directory '\$destinationPath' on
host \${destinationHost%:}.\"
        errorOccoured=2
        if (( isCritical != 0 )); then
          _fg_Error \"The last error was marked as critical. Aborting
the file delivery operation.\"
          return \$errorOccoured
        fi
      fi

      if (( cpFailed == 0 )) ; then
        cpFailed=1

        if _fg_isLocal \"\${sourceHost%:}\" && _fg_isLocal
\"\${destinationHost%:}\" ; then
          msg=\$( \\
            _fg_FileDeliveryOptimizedCpOperation \"\$rmFlag\"
\"\$trySymlink\" \"\$isRmImmediate\" \"\$cpOptions\" \\
                        \"\${sourcePath}\" \"\${sourceFile}\" \\
                        \"\${destinationPath}\" \"\${destinationFile}\" \\
          )
          cpFailed=\$?
          if (( isRmImmediate != 0 )) && (( cpFailed & 32 )) ; then
                let 'cpFailed = cpFailed - 32'
                rmFlag=0
          fi
          if (( cpFailed == 0 )) ; then
            _fg_Log \$(( _fg_LOG_FUNCTION_INTERALS1 |
_fg_LOG_FUNCTION_INTERALS3 )) \"\$msg\"
          fi

        elif [[ \"x\${sourceHost}\" = \"x\${destinationHost}\" ]] ; then
          msg=\$( \\
            print -r -- '_fg_FileDeliveryOptimizedCpOperation \"\...@\"' | \\
            _fg_CreateRemoteScript _fg_FileDeliveryOptimizedCpOperation | \\
            _fg_RemoteScript -n \"\${sourceHost%:}\" \"\$rmFlag\"
\"\$trySymlink\" \"\$isRmImmediate\" \"\$cpOptions\" \\
                    \"\${sourcePath}\" \"\${sourceFile}\" \\
                    \"\${destinationPath}\" \"\${destinationFile}\" \\
          )
          cpFailed=\$?
          if (( isRmImmediate != 0 )) && (( cpFailed & 32 )) ; then
                let 'cpFailed = cpFailed - 32'
                rmFlag=0
          fi
          if (( cpFailed == 0 )) ; then
            _fg_Log \$(( _fg_LOG_FUNCTION_INTERALS1 |
_fg_LOG_FUNCTION_INTERALS4 )) \"on host \${sourceHost%:}:\" \"\$msg\"
          fi
        fi

        if (( cpFailed != 0 )) ; then
          if (( ignoreErrors == 0 )) ; then
            _fg_RCP -p \$cpOptions
\"\${sourceHost}\${sourcePath}/\${sourceFile}\" \\
              \"\${destinationHost}\${destinationPath}/\${destinationFile}\"
&& :
            cpFailed=\$?
          else
            _fg_RCP --optional -p \$cpOptions
\"\${sourceHost}\${sourcePath}/\${sourceFile}\" \\
              \"\${destinationHost}\${destinationPath}/\${destinationFile}\"
2>/dev/null && :
            cpFailed=\$?
          fi
        fi

        if (( cpFailed != 0 )) && (( ignoreErrors == 0 )) ; then
          _fg_Error \"Copying of file
'\${sourceHost}\${sourcePath}/\${sourceFile}' to
'\${destinationHost}\${destinationPath}/\${destinationFile}' failed.\"
          errorOccoured=2
          if (( isCritical != 0 )); then
            _fg_Error \"The last error was marked as critical.
Aborting the file delivery operation.\"
            return \$errorOccoured
          fi
        fi
      fi
    fi

    if [  \$rmFlag -eq 1 -a \"\$cpFailed\" -eq 0 ]; then
      if [ \$isRmImmediate -eq 0 ]; then
        filestoremove[\${#filestoremo...@]}]=\"\$rmOptions\"
        filestoremove[\${#filestoremo...@]}]=\"\${sourceHost%:}\"
        filestoremove[\${#filestoremo...@]}]=\"\${sourcePath}/\${sourceFile}\"
      else
        host=\"\${sourceHost%:}\"
        if _fg_isLocal \"\${host:-\$LOCAL_HOST}\" ; then
          set +f
          IFS=''
          rm -f \$rmOptions \${sourcePath}/\${sourceFile} || cpFailed=1
          IFS=\"\$ifsOrig\"
          eval \"\$(_fg_setShellFlags)\"
        else
          _fg_RSH \"\${host}\" -n \"IFS='' ; rm -f \$rmOptions
\${sourcePath}/\${sourceFile}\" || cpFailed=1
        fi
        if [ \"\$cpFailed\" -ne 0 -a \"\$ignoreErrors\" -eq 0 ] ; then
          _fg_Error \"Removing file
'\${sourceHost}\${sourcePath}/\${sourceFile}' with options
'\$rmOptions' failed.\"
          let 'errorOccoured=errorOccoured|1'
          if (( isCritical != 0 )); then
            _fg_Error \"The last error was marked as critical.
Aborting the file delivery operation.\"
            return \$errorOccoured
          fi
        fi
      fi
    fi
  done

  if (( \${#filestoremo...@]} > 0 )) ; then
    if (( \$errorOccoured == 0 )) ; then
      # loop over the remove list
      # work around a ast-ksh optimizer bug with eval '...'
      while eval '(( \${#filestoremo...@]} > 0 )) && :' ; do
        # get a remove list entry
        set -- \"\${filestoremo...@]}\"
        flags=\"\$1\"; shift
        host=\"\${1:-\$LOCAL_HOST}:\"; shift
        file=\"\$1\"; shift
        set -A filesToRemove -- \"\...@\"

        # prepare some flags. Default is a copy operation
        # rmFlag=0

        if _fg_isLocal \"\${host%:}\" ; then
          set +f
          IFS=''
          rm -f \$flags \$file || errorOccoured=1
          IFS=\"\$ifsOrig\"
          eval \"\$(_fg_setShellFlags)\"
        else
          _fg_RSH \"\${host%:}\" -n \"IFS='' ; rm -f \$flags \$file\"
|| errorOccoured=1
        fi
      done
    else
      _fg_Warn \"skiped removal of files due to previous errors\"
    fi
  fi

  return \"\$errorOccoured\"
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



_fg_generateFunctionImplementation --defineVars
"_fg_FileDeliveryOptimizedCpOperation" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_FileDeliveryOptimizedCpOperation_code=\
"

{
  typeset rmFlag=\"\$1\" ; shift
  typeset trySymlink=\"\$1\" ; shift
  typeset isRmImmediate=\"\$1\" ; shift
  typeset cpOptions=\"\$1\" ; shift
  typeset sourcePath=\"\$1\" ; shift
  typeset sourceFile=\"\$1\" ; shift
  typeset destinationPath=\"\$1\" ; shift
  typeset destinationFile=\"\$1\" ; shift

  typeset sp
  typeset dp
  typeset cpFailed
  typeset ifsOrig=\"\$IFS\"
  typeset cpCmd=\"cp\"
  typeset msg
  typeset file

  _fg_setHOME
  sp=\"\$(_fg_makeAbsolutePath \"\${sourcePath}\" \"\$HOME\")\"
  dp=\"\$(_fg_makeAbsolutePath \"\${destinationPath}\" \"\$HOME\")\"

  typeset cpFailed=1
  typeset fileFailed
  typeset mvFailed

  IFS=''
  set +f

  if (( rmFlag != 0 )) ; then
     cpFailed=0
     mvFailed=0
     for file in \"\${sp%/}/\"\${sourceFile} ; do
        set -f
        fileFailed=1

        if (( isRmImmediate != 0 )) ; then
           print -r -- \"mv -f \${cpOptions}\" \"\${file}\"
\"\${dp%/}/\${destinationFile}\"
           mv -f \${cpOptions} \"\${file}\" \"\${dp%/}/\${destinationFile}\"
           fileFailed=\$?
           if (( fileFailed != 0 )) ; then
              mvFailed=1
           fi
        fi

        (( fileFailed == 0 )) || [[ -d \"\${file}\" ]] || if [[ -w
\"\${sourcePath}\" ]] ; then
           print -r -- \"ln -f\" \"\${file}\"  \"\${dp%/}/\${destinationFile}\"
           ln -f \"\${file}\" \"\${dp%/}/\${destinationFile}\" 2>/dev/null && :
           fileFailed=\$?
        fi

        if (( fileFailed != 0 )) ; then
           cpFailed=1
        fi
     done

     if (( isRmImmediate != 0 )) && (( mvFailed == 0 )) ; then
        let 'cpFailed = cpFailed | 32'
     fi
  fi

  if (( rmFlag == 0 )) && (( trySymlink == 1 )) ; then
    print -r -- \"ln -s -f\" \"\${sp%/}/\"\${sourceFile}
\"\${dp%/}/\${destinationFile}\"
    ln -s -f \"\${sp%/}/\"\${sourceFile}
\"\${dp%/}/\${destinationFile}\" 2>/dev/null && :
    cpFailed=\$?
  fi

  eval \"\$(_fg_setShellFlags)\"
  IFS=\"\${ifsOrig}\"
  return \$cpFailed
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null



fi


_fg_FileDelivery "${SOURCE_HOST%:}" \
        "${DEST_HOST%:}" \
":--optional::::/tmp//:/tmp/fileA/."\
  && :
EXITVAL="$?"


test "$EXITVAL" = "0" && :
_fg_reportWfState "BasicCopy1" \
"24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS.BasicCopy1"
\
"Running" "$?" \
"Done" \
"ClosedFailed"
#
#####    end of BasicCopy1 ####
#

fi
if [ "$EXITVAL" = "0" ]; then
#
#####  start wf BasicShellScript1 ####
#


test true = true && :
_fg_reportWfState "BasicShellScript1" \
"24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS.BasicShellScript1"
\
"Ready" "$?" \
"Running" \
""
#!/bin/ksh

WORKING_DIR="/tmp/caejobs/qx04803/ABAQUS/BMW/flowguide/abaqus/20070813_154320"

if [ -n "${WORKING_DIR}" ]; then
        cd "${WORKING_DIR}" || exit 99
fi

set +efx

if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
  print -r -- "${PS4}# CodeForExecutingCommand: start of environment
code" 1>&"$_fg_functionStderrHandle"
fi
if (( $_fg_debug & $_fg_DEBUG_APPLICATION_EXECUTION )) ; then
  set -x
else
  if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
    print -r -- "${PS4}# CodeForExecutingCommand: debugging turned off
for environment code" 1>&"$_fg_functionStderrHandle"
  fi
fi

SOLVER_EXECUTABLE="abaqus"
NCPUS="1"
REMOVE_INPUT_DIR="1"
TMP_INPUT_DIR="$(_fg_mapWinPath2Unix
'/home/XXXXX/BMW/flowguide/abaqus')/20070813_154320"
COLLECT_RES_INFO="0"
TOOLS="/home/XXXXX/resourcenoptimierung_fg"
MODELNAME="one_element"
INPUTFILE="one_element.inp"
APPLICATION="abaqus"
APPLVERSION="v664"
HTTP_FILES=".msg .log .eo"
MAIL_AT_END="false"
FID=""
fileID=""
K5MUTE="1"
TID="20070813_154320"
WINDOWS_SUBMIT="false"
FS="sphsm.muc"
FS_DIR="$(_fg_mapWinPath2Unix
'/tmp/caejobs/qx04803/ABAQUS/BMW/flowguide/abaqus')"
FS_DIR_WIN="/tmp/caejobs/qx04803/ABAQUS/BMW/flowguide/abaqus"
WS="caefl06.muc"
WS_DATA="$(_fg_mapWinPath2Unix '/home/XXXXX/BMW/flowguide/abaqus')"
WS_DATA_WIN="/home/XXXXX/BMW/flowguide/abaqus"
WS_IN="$(_fg_mapWinPath2Unix '/home/XXXXX/BMW/flowguide/abaqus')"
WS_PWD="$(_fg_mapWinPath2Unix '/home/XXXXX/BMW/flowguide/abaqus');"
file="$(_fg_mapWinPath2Unix '/home/XXXXX/BMW/flowguide/abaqus/one_element.inp')"
utid="20070813_154320"
FG_SCRIPTDIR="$(_fg_mapWinPath2Unix '/share/xxx/flowguide/1.4/INDEP/scripts')"
frame="$(_fg_mapWinPath2Unix
'/home/XXXXX/BMW/flowguide/abaqus/one_element.inp')"
WF_HOME="$(_fg_mapWinPath2Unix
'/share/xxx/flowguide/1.4/INDEP/../workflows/bmw_default')"
fileExt=".dat"
fileName="one_element.inp"
TOSCAFILE=""
TOSCA_SIZE=""
MEMORY="500"
PRE_MEMORY="500"
SEPARATE_DELIVERY="false"
FILTERS=""
RESTARTPATH="\$FS_DIR"
FG_LOGDIR="/home/XXXXX/.flowguide/UNIX/LOGS"
FG_WF_LOGFILE="null.AbaqusRestart_param_070813_154313.log"
FG_SUBWF_LOGFILE="24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS.BasicShellScript1"

export  SOLVER_EXECUTABLE NCPUS REMOVE_INPUT_DIR TMP_INPUT_DIR
COLLECT_RES_INFO TOOLS MODELNAME INPUTFILE APPLICATION APPLVERSION
HTTP_FILES MAIL_AT_END FID fileID K5MUTE TID WINDOWS_SUBMIT FS FS_DIR
FS_DIR_WIN WS WS_DATA WS_DATA_WIN WS_IN WS_PWD file utid FG_SCRIPTDIR
frame WF_HOME fileExt fileName TOSCAFILE TOSCA_SIZE MEMORY PRE_MEMORY
SEPARATE_DELIVERY FILTERS RESTARTPATH FG_LOGDIR FG_WF_LOGFILE
FG_SUBWF_LOGFILE


set +x
if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
  print -r -- "${PS4}# CodeForExecutingCommand: end of environment
code." 1>&"$_fg_functionStderrHandle"
  set -x
fi




_fg_generateFunctionImplementation --defineVars "_fg_reportPidToFlowguide" \
debug="" \
logFlags="" \
requires="" \
noWrapper=""
_fg_reportPidToFlowguide_code=\
"

{
    echo \$\$ >> /home/XXXXX/.flowguide/UNIX/PID/\${FG_SUBWF_LOGFILE%.log}.pid
}
"
_fg_generateFunctionImplementation --defineFunctions </dev/null


_fg_reportPidToFlowguide

set +x
if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
  print -r -- "${PS4}# CodeForExecutingCommand: start of application
code" 1>&"$_fg_functionStderrHandle"
fi
if (( $_fg_debug & $_fg_DEBUG_APPLICATION_EXECUTION )) ; then
  set -x
else
  if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
    print -r -- "${PS4}# CodeForExecutingCommand: debugging turned off
for application code" 1>&"$_fg_functionStderrHandle"
  fi
fi

:

eval ""


_fg_AR="$?"
set +x
if (( $_fg_debug & $_fg_DEBUG_SCRIPT_EXECUTION )) ; then
  print -r -- "${PS4}# CodeForExecutingCommand: end of application
code. exit code: $_fg_AR" 1>&"$_fg_functionStderrHandle"
  set -x
fi
eval "$(_fg_setShellFlags "$_fg_AR")" && :
EXITVAL="$?"
#Set the specified accepted exit values to 0
if [ "$EXITVAL" = "0" ]; then
EXITVAL="0"
elif [ "$EXITVAL" = "0" ]; then
EXITVAL="98"
fi


test "$EXITVAL" = "0" && :
_fg_reportWfState "BasicShellScript1" \
"24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS.BasicShellScript1"
\
"Running" "$?" \
"Done" \
"ClosedFailed"
#
#####    end of BasicShellScript1 ####
#

fi


test "$EXITVAL" = "0" && :
_fg_reportWfState "TransferToFS" \
"24.AbaqusRestart_param_070813_154313.AbaqusRestart_instance.AbaqusStandard.CreateJobs.LSFjobsWithFS.TransferToFS"
\
"Running" "$?" \
"Done" \
"ClosedFailed"

exit "$EXITVAL"
# end of script

-------------------------* snap *---------------------------------

       Werner

--
 Dr. Werner Fink <werner at suse.de>
 SuSE LINUX Products GmbH,  Maxfeldstrasse 5,  Nuernberg,  Germany
 GF: Markus Rex,  HRB 16746 (AG Nuernberg)
 phone: +49-911-740-53-0,  fax: +49-911-3206727,  www.opensuse.org
------------------------------------------------------------------
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
_______________________________________________
ast-users mailing list
ast-users at research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-users


-- 
Cheers,
William
-- 
    @,,@   William James
   (\--/)  williamjamesgnusolaris at gmail.com
  (.>__<.) GNU/Solaris hacker

Reply via email to