Skip to content

b1f6c1c4/remote-exec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

, and ,,: Run commands on remote server with sshfs

Overview

  • ,: Run commands on remote server with all files stored remotely
    • Pros: Remote commands access files without networking, reducing latency
    • Pros: Save huge disk space on your local machine.
    • Cons: If the remote machine is down, you cannot work at all.
    • Cons: Cannot switch among multiple remote machines easily.
    • Cons: During setup, you need to manually transfer all your data.
    • Use this mode when: Compile gcc, llvm, Linux kernel, etc.
  • ,,: Run commands on remote server with all files stored locally
    • Pros: Setup is instant and does not involve any data movement.
    • Pros: You can still work locally when the remote machine is down.
    • Pros: You can easily switch among multiple remote machines.
    • Cons: Remote commands access files through networking, increasing latency
    • Cons: Higher disk usage on local machine.
    • Cons: Local commands access files through internet, increasing latency
    • Use this mode when: Unit testing your own work.

Note: You need sshfs installed on both machine.

Usage - ,

  1. On your local machine, create an empty folder called magic:

    mkdir magic
  2. Create a config file in the folder:

    echo 'RMT_HOST=<user>@<host>' > magic/.rmt-config
  3. Make the magic folder magic by:

    . , magic
  4. Now you can operate on the folder from both side in one single shell:

    vim Makefile   # Edit files using local machine
    , make -j64    # Run heavy jobs using remote machine

    Note: Files are stored remotely but is visible locally thanks to sshfs.

  5. You can of course launch a remote shell like ssh:

    ,
  6. To stop the magic:

    . ,

    Note: Files are still stored on the remote machine.

  7. To get the files back, simply type . , magic again.

Usage - ,,

  1. Inside a non-empty folder, create a config file in the folder:

    echo 'RMT_HOST=<user>@<host>' > magic/.rmt-config
  2. Now you can operate on the folder from both side in one single shell:

    ,, make -j64    # Run heavy jobs using remote machine

    Note: Files are stored remotely but is visible locally thanks to sshfs.

  3. You can of course launch a remote shell like ssh:

    ,,
  4. To stop:

    ,, ,

    Note: Files are still stored on the local machine.

Configuration: .rmt-config

  • RMT_HOST: (Required) The remote machine.
  • RMT_LOCALHOST: (Required for ,,) The local machine.
  • RMT_SSH: (Optional) To override the command line for ssh. Default is ssh -Y -t.
  • RMT_SSHFS: (Optional) To override the command line for sshfs, Default is sshfs.
  • RMT_RENV: (Optional) Will be added to the command line of /usr/bin/env during ssh call.
  • RMT_RSHELL: (Optional) To override the login shell on remote machine. Default is to be automatically detected.
  • RMT_RDIR: (Optional) To specify where to store the files on remote machine. A path relative to $HOME. Default is .rmt/.

Limitation

Quotation and escape is a mess. If your command contains $, escape carefully. There's absolutely no gurantee that any kind of escape will or will not work. If you want to run any command containing &&, ||, or |, use the remote shell by typing , alone.

License

MIT

About

Run command on remote machine using sshfs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages