Megatest

nbfake at [2f38818a05]
Login

File utils/nbfake artifact e5bec056c7 part of check-in 2f38818a05


#!/bin/bash

# Can't always trust $PWD
CURRWD=`pwd`

if [[ $TARGETHOST_LOGF == "" ]]; then
    TARGETHOST_LOGF=NBFAKE-`date +%GWW%V.%u_%T`
fi
echo "#======================================================================"
echo "# NBFAKE Logging command to $TARGETHOST_LOGF"
echo "#     \"$*\""
echo "#======================================================================"

if [[ $TARGETHOST == ""  ]]; then
  unset TARGETHOST
  TARGETHOST_LOGF_TEMP=$TARGETHOST_LOGF
  unset TARGETHOST_LOGF
  sh -c "cd $CURRWD;export DISPLAY=$DISPLAY; export PATH=$PATH; nohup $* >> $TARGETHOST_LOGF_TEMP 2>&1 &"
else
  ssh -n -f $TARGETHOST "sh -c \"cd $CURRWD;export DISPLAY=$DISPLAY; export PATH=$PATH; nohup $* >> $TARGETHOST_LOGF 2>&1 &\""
fi