Coder Social home page Coder Social logo

offboard-projects's Introduction

What it is about

I have a PC I use as "terminalserver" for development. It has a small SSD, but a large HDD attached.

This helper scripts help move projects I currently don't work on from SSD to HDD, and adding a symlink to the "offboarded" location. When I want to work on the project again (and need the I/O speed), the project is moved back to the SSD ("onboarding").

To make re-offboarding fast, the onboarded state is kept on the HDD and re-used when offboarding the project again.

Example

cd my-projects && ls -al
drwxr-xr-x 1 developer developer    0 May 22 23:15 project-a
drwxr-xr-x 1 developer developer    0 May 22 23:15 project-b
drwxr-xr-x 1 developer developer    0 May 22 23:15 project-c

Now let's offboard project-b:

offboard.sh project-b
# <output skipped>
ls -al
drwxr-xr-x 1 developer developer    0 May 22 23:15 project-a
lrwxrwxrwx 1 developer developer   58 May 22 23:16 project-b -> /mnt/disk/my-projects/project-b.offboarded
drwxr-xr-x 1 developer developer    0 May 22 23:15 project-c

Due to the symlink, it is still possible to work with the projects. It's just slow(er) due to being on the HDD instead of the SSD.

Let's re-onboard the project:

onboard.sh project-b
# <output skipped>
drwxr-xr-x 1 developer developer    0 May 22 23:15 project-a
drwxr-xr-x 1 developer developer    0 May 22 23:15 project-b
drwxr-xr-x 1 developer developer    0 May 22 23:15 project-c

While the project has now been copied back to the project disk, the old state remains as offboarding basis in the offboarding location:

ls -al /mnt/disk/my-projects/
drwxr-xr-x 1 developer developer  0 May 22 23:15 project-b.onboarded

Installation

Copy or symlink the two helper scripts to a location in your path, e.g. /usr/local/bin or $HOME/bin/.

Configuration

Configuration is done via environment variables. Those can either be set via export in the shell, or via a config file in one of the following two locations:

  • $HOME/.offboard.env
  • /etc/offboard.env

The following variables need to be defined:

  • ONBOARD_BASE_DIR: the base-directory of the SSD, typically your $HOME
  • OFFBOARD_BASE_DIR: the base-directory where to offboard projects to. The directory structure from the onboarded base-directory is re-created there as needed during offboarding.

If one of the config files exists, it is sourced into the script, so can use the following template to have existing environment variables take precedence:

[ -z "$ONBOARD_BASE_DIR" ]  && export ONBOARD_BASE_DIR=/home/developer
[ -z "$OFFBOARD_BASE_DIR" ] && export OFFBOARD_BASE_DIR=/mnt/disk

offboard-projects's People

Contributors

capi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.