run_remotely.sh 873 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. # Example:
  3. # first 'cd' to the directory with your model then run:
  4. # run_remotely.sh $USER@<machine>:/home/$USER/tmp/my_model <path to mcell4_runner>/mcell4_runner.py . "model.py -s 1:10:1"
  5. USAGE=\
  6. "$1 - remote machine with user and working directory e.g. [email protected]:/home/user/tmp\n"\
  7. "$2 - local path to mcell4_runner.py script (including the script name)\n"\
  8. "$3 - directory with model\n"\
  9. "$4 - arguments for mcell4_runner.py script (enclosed in quotes)\n"
  10. if [ "$#" != "4" ]; then
  11. echo "Error: expected 4 arguments:\n $USAGE"
  12. exit 1
  13. fi
  14. DST=$1
  15. RUNNER_PY=$2
  16. SRC=$3
  17. ARGS=$4
  18. # copy model directory
  19. rsync --delete -arv $SRC $DST || exit 1
  20. # copy script
  21. rsync --delete -arv $2 $DST || exit 1
  22. URL=`echo $DST | cut -d: -f1`
  23. DIR=`echo $DST | cut -d: -f2`
  24. CMD="conda activate py35; cd $DIR; nohup python mcell4_runner.py $4"
  25. ssh $URL $CMD