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 files in /tmp/ on the remote host and run
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.p on the remote side,
47 6. get back all the files with the .txt extension,
48 7. delete the working directory on the remote side.