4 This is a very simple bash script to run scripts on a remote machine
5 accessible by ssh, send required files, and get back result files
8 It creates a temporary directory in /tmp/ on the remote host and runs
11 I use it mostly to launch heavy training with PyTorch on a PC at home.
18 xremote.sh ./example.py
21 where [`example.py`](https://fleuret.org/git-extract/xremote/example.py) is the file given with `xremote.sh`:
28 # @XREMOTE_EXEC: python3
31 # @XREMOTE_PRE: ls -lt > files.txt
33 print('I am being executed!')
35 file = open('result.txt', 'w')
36 file.write('This is a text.\n')
42 1. create a temporary directory on the remote host 'elk'
43 2. copy there the file example.py,
44 3. copy there files from the local dir with the .py extension,
45 4. list all files on the remote side into the file files.txt,
46 5. execute example.py on the remote side with python3,
47 6. get back all the files with a .txt extension,
48 7. delete the working directory on the remote side.