Plan 9 from Bell Labs’s /usr/web/sources/contrib/mycroftiv/hubfs/README

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Provides GNU screen-like functionality via a 9p fs of io Hubs.
Use the hub wrapper script to start the hubfs and hubshell.

STARTING AND CONNECTING WITH 'HUB' WRAPPER SCRIPT
hub aug5 #starts and connects to a new hubfs and posts /srv/aug5
hub aug5 #connects a new client to the rc shell started by the previous command
hub aug5 rctwo #starts and connects to new rc named rctwo within the aug5 hubfs
hub #starts a hubfs named hubfs with an rc named io
hub #connects to the default hubfs io

MAKING NEW SHELLS AND MOVING IN HUBSHELL:
-all commands begin with '%' as first character-
%detach  #disconnect from attached shell
%remote NAME #start a new shell on remote machine
%local NAME #start a new shell on local machine shared to hubfs server
%attach NAME #move to an existing hubfs shell
%err TIME, %in TIME, %out TIME #time in ms for delay loop on file access
%status #basic hubfs connection info
%list #lc of connected hubfs hubs

CONTROLLING HUBFS ITSELF VIA CTL FILE:
-reading from ctl file returns status-
echo freeze >/n/hubsrv/ctl #freeze Hubs as static files for viewing and editing
echo melt >/n/hubsrv/ctl #resume normal flow of data
echo fear >/n/hubsrv/ctl #activate paranoid mode and fswrites wait for fsreads to output data
echo calm >/n/hubsrv/ctl #resume standard non-paranoid data transmission mode
echo quit >/n/hubsrv/ctl #bring everything to a crashing halt and kill the fs

NOTES:
Each rc shell makes use of 3 Hubs, one for each file descriptor.
A Hub file provides both input and output.
You can create additional freeform pipelines by touching files to create Hubs.

SCRIPTS FOR USE FROM P9P/UNIX:
I use 9pfuse in combination with a one-connection listener from plan9
and two tiny scripts to let me access plan 9 hubfs shells from linux
and share linux shells back to plan9.  Here is an example sequence:

plan9:

hub -b linhub
mount -c /srv/linhub /n/linhub
touch /n/linhub/lin0
touch /n/linhub/lin1
touch /n/linhub/lin2
aux/listen1 -tv tcp!*!19999 /bin/exportfs -r /n/linhub 
# non-authed listen1 will be open for a few seconds, monitor -v output

linux:

mkdir hubfs
9pfuse 'tcp!ip.of.hub.server!19999' hubfs
puthub hubfs/lin
gethub hubfs/io

This results in a linux shell being shared back to the hubfs at lin,
and a plan9 shell accessible to the linux machine.  At this point the
listen1 command on plan9 can and should be terminated, it is not
needed after the connection is made.  gethub and puthub scripts:

#!/bin/bash
# puthub path
rc -i <$1"0" >>$1"1" 2>>$1"2" &

#!/bin/bash
# gethub path
cat $1"1" &
cat $1"2" &
cat >>$1"0"
kill %1
kill %2


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.