Workspaces/Advanced Features/ws register: Difference between revisions

From bwHPC Wiki
Jump to navigation Jump to search
(Created page with "= ws_register - Register Workspace Links = The <tt>ws_register</tt> command creates or updates symbolic links to your workspaces in a directory of your choice. This provides a convenient way to access all your workspaces from a single location. == Syntax == <tt>ws_register [-h] [--version] [-F FILESYSTEM] directory</tt> == Usage == $ ws_register ~/workspaces This will create symbolic links to all your workspaces in the <tt>~/workspaces</tt> directory. The comman...")
 
mNo edit summary
 
Line 1: Line 1:
= ws_register - Register Workspace Links =
= ws_register - Create Workspace Links =


The <tt>ws_register</tt> command creates or updates symbolic links to your workspaces in a directory of your choice. This provides a convenient way to access all your workspaces from a single location.
Creates symbolic links to all your workspaces in one convenient directory.


== Syntax ==
== Basic Usage ==


$ ws_register ~/workspaces # Create links in ~/workspaces
<tt>ws_register [-h] [--version] [-F FILESYSTEM] directory</tt>


The command creates subdirectories for each filesystem (e.g., <tt>scratch/</tt>) with links to your workspaces.
== Usage ==


== Example ==
$ ws_register ~/workspaces

This will create symbolic links to all your workspaces in the <tt>~/workspaces</tt> directory. The command creates subdirectories for each filesystem (e.g., <tt>scratch/</tt>) and places workspace links inside them.

Example:


$ mkdir -p ~/my_workspaces
$ mkdir -p ~/my_workspaces
$ ws_register ~/my_workspaces
$ ws_register ~/my_workspaces
$ ls -l ~/my_workspaces/scratch/
$ ls -l ~/my_workspaces/scratch/
lrwxrwxrwx 1 user group 45 Nov 17 10:30 user-myWs -> /work/workspace/scratch/user-myWs-0
lrwxrwxrwx ... user-myWs -> /work/workspace/scratch/user-myWs-0
lrwxrwxrwx 1 user group 48 Nov 17 10:30 user-project1 -> /work/workspace/scratch/user-project1-0
lrwxrwxrwx ... user-project1 -> /work/workspace/scratch/user-project1-0


'''Note:''' Links use the full workspace names (including username prefix), organized by filesystem subdirectory.
'''Note:''' Links include the full workspace name (with username prefix).


== Options ==
== Options ==
Line 31: Line 27:
|-
|-
|<tt>directory</tt>
|<tt>directory</tt>
|Directory in which links shall be created/updated (required positional argument)
|Target directory for links (required)
|-
|-
|<tt>-F <filesystem></tt>, <tt>--filesystem <filesystem></tt>
|<tt>-F <filesystem></tt>
|Filesystem to search workspaces in. Only create links for workspaces on this filesystem
|Only create links for workspaces on specific filesystem
|-
|-
|<tt>-h</tt>, <tt>--help</tt>
|<tt>-h</tt>, <tt>--help</tt>
|Show help message
|Show help
|-
|-
|<tt>--version</tt>
|<tt>--version</tt>
|Show program's version number and exit
|Show version
|}
|}


== When to use ==
== When to Use ==

* Working with multiple workspaces
* Need quick access from one location
* Organizing workspaces by project


== Automatic Updates ==
* '''Recommended''' if you work with multiple workspaces and want quick access
* Use in your <tt>~/.bashrc</tt> or login scripts to automatically update links at login
* Useful for organizing workspaces by project or purpose


Add to <tt>~/.bashrc</tt> to update links automatically at login:
== Example in login script ==


<pre>
<pre>
# Only run in interactive shells
# In ~/.bashrc or ~/.profile
# Only run in interactive shells to avoid issues with scp, rsync, etc.
if [ -t 0 ] && [ -z "$SSH_ORIGINAL_COMMAND" ] && command -v ws_register >/dev/null 2>&1; then
if [ -t 0 ] && [ -z "$SSH_ORIGINAL_COMMAND" ] && command -v ws_register >/dev/null 2>&1; then
mkdir -p ~/workspaces >/dev/null 2>&1
mkdir -p ~/workspaces 2>/dev/null
ws_register ~/workspaces >/dev/null 2>&1
ws_register ~/workspaces 2>/dev/null
fi
fi
</pre>
</pre>


For more information: <tt>$ ws_register -h</tt> or <tt>man ws_register</tt>
For more information: <tt>ws_register -h</tt> or <tt>man ws_register</tt>

Latest revision as of 16:51, 2 December 2025

ws_register - Create Workspace Links

Creates symbolic links to all your workspaces in one convenient directory.

Basic Usage

  $ ws_register ~/workspaces               # Create links in ~/workspaces

The command creates subdirectories for each filesystem (e.g., scratch/) with links to your workspaces.

Example

  $ mkdir -p ~/my_workspaces
  $ ws_register ~/my_workspaces
  $ ls -l ~/my_workspaces/scratch/
  lrwxrwxrwx ... user-myWs -> /work/workspace/scratch/user-myWs-0
  lrwxrwxrwx ... user-project1 -> /work/workspace/scratch/user-project1-0

Note: Links include the full workspace name (with username prefix).

Options

Option Description
directory Target directory for links (required)
-F <filesystem> Only create links for workspaces on specific filesystem
-h, --help Show help
--version Show version

When to Use

  • Working with multiple workspaces
  • Need quick access from one location
  • Organizing workspaces by project

Automatic Updates

Add to ~/.bashrc to update links automatically at login:

# Only run in interactive shells
if [ -t 0 ] && [ -z "$SSH_ORIGINAL_COMMAND" ] && command -v ws_register >/dev/null 2>&1; then
    mkdir -p ~/workspaces 2>/dev/null
    ws_register ~/workspaces 2>/dev/null
fi

For more information: ws_register -h or man ws_register