Table of Contents
$ . ~legion/setup.sh
or
$ source ~legion/setup.cshThe following style conventions are used in these tutorials:
Documentation about context space
There are several other sources of information about Legion commands: a Quick Reference Guide lists all commands' syntax and the Reference Manual has complete information about all Legion commands (both available here in PostScript and PDF); the Legion release package includes man pages1 for all commands; and, on-line, there is an explanation of Legion commands and a quick list of the commands' syntax.
$ legion_ls / class home hosts impls vaults $
$ legion_ls / Fooclass Foofile Fooobject class home hosts impls vaults $
$ legion_ls /hosts . .. BootstrapHost your.host.DNS.name $
You can use the -l and -a flags to get information about object types and descriptions. The -l flag displays object types and descriptions.
$ legion_ls -l / Fooclass (class) Foofile 43 bytes Fooobject (object) class (context) home (context) hosts (context) impls (context) vaults (context) $
The -a flag shows "hidden" objects, such as those whose names begin with a ".":
$ legion_ls -a / . Fooclass Foofile Fooobject class home hosts impls vaults $
$ legion_ls -L Foofile Foofile 1.01.66000000.02000000.00000... $
Use the -L flag to list LOIDs associated with a context's entries. The output will be a "dotted hex" LOID.3
$ legion_ls -L Fooclass 1.35fe7c3d.07..000001fc0a7838d45ed Foofile 1.01.66000000.02000000.00000... Fooobject 1.35fe7c3d.66000000.01000000.00 class 1.01.05.02000000.00000... home 1.01.05.05000000.00000... hosts 1.01.05.03000000.00000... impls 1.01.05.06000000.0000 vaults 1.01.05.04000000.00000... $
$ legion_ls -L /hosts/BootstrapHost 1.01.07.680c2608.000001fc0c1e0... $
$ legion_context_create /tmp Creating context "tmp" in parent ".". New context LOID = "1.01.05.6c0c2608.000001fc0c923..." $
$ legion_set_context /tmp
Verify the current working context
$ legion_pwd /tmp $
Assigning multiple names to an object
Below, the new name Foo is assigned to the BootstrapHost object and placed in the /tmp context.
$ legion_ln /hosts/BootstrapHost /tmp/Foo $ legion_ls -la /tmp . (context) .. (context) Foo $
$ legion_ls -L /tmp/Foo 1.01.07.680c2608.000001fc0c1e0a395a4... $ $ legion_ls -L /hosts/BootstrapHost 1.01.07.680c2608.000001fc0c1e0a395a4... $
Assigning a context name to a LOID
$ legion_context_add 1.38e67781.07.01000000.000001fc0c1d 0f8ed1db36d559a5711c327b4131c51648b20f053feb0aeb55fb080c ac5051b089805391f71629b3db6b8034124c5690b348355fb0c0f5f2 c3dc06f02a2f newName
$ legion_mv Foo Bar
The legion_list_names command will list all context paths that have been assigned to a given object. You must provide either a LOID or a context name. If you know an object's LOID you can use the -l flag to ask Legion to look up the object's name(s).
$ legion_list_names -l 1.38e67781.07.01000000.000001fc0c 1d0f8ed1db36d559a5711c327b4131c51648b20f053feb0aeb55fb08 0cac5051b089805391f71629b3db6b8034124c5690b348355fb0c0f5 f2c3dc06f02a2f /hosts/BootstrapHost /hosts/my.host.DNS.name $
If you already have a context name you can see what (if any) other names it has. This list will include names that other users (or the system) have assigned the object.
$ legion_list_names /hosts/BootstrapHost /hosts/BootstrapHost /hosts/my.host.DNS.name $
Similarly, legion_ls plus the -A flag looks up an object's other (if any) name[s]:
$ legion_ls -A /hosts/BootstrapHost
/hosts/BootstrapHost
/hosts/BootstrapHost
/hosts/my.host.DNS.name
$$ legion_rm Bar
$ legion_rm Foo
The name Foo would be removed but the associated object would remain. If you then run:
$ legion_rm Foo2
The name Foo2 and the object will be destroyed, since Foo2 is its only context name. Use legion_ls -A to see whether or not an object has other names if you are not sure.
You can use the -v flag to run legion_rm in a verbose setting, which will show you whether objects or just context paths are being destroyed. E.g.,
$ legion_rm -v Foo2 Removing context name "foo2" Destroying object "foo2" (1.3759173a.690...) $
If you want to recursively remove an entire context and its contents, use the -r flag.
Using the same name in different contexts
Below, the name Bar is assigned to a LOID with the legion_ln command.
$ legion_ln Foo Bar
$ legion_ln OtherFoo /tmp/Bar
$ legion_ln Foo Bar $ legion_ln Foo /tmp/Bar
Copying a local file to a Legion BasicFileObject
$ legion_cp -localsource UnixTextFile.txt newFileObject
Note that if you copy new material into a previously existing BasicFileObject the new material will write over any old material.
$ legion_cp newFileObject newFileObject_copy
Use the -localdest flag to copy the contents of a BasicFileObject to a new text file in the local file system.
$ legion_cp -localdest newFileObject anotherTextFile.txteObject_copy
Viewing the contents of a file object
$ legion_cat newFileObject This is a test, just a test, nothing more. $
In the example below, the contents of the Unix directory legion.practice are copied into the current Legion context. A listing of the Unix directory's contents shows that the directory contains one sub-directory and three files. The subdirectory /nextlevel also contains three files.
$ ls -Fa legion.practice ./ ../ nextlevel/ nothing nothing2 nothing3 $ ls -Fa legion.practice/nextlevel ./ ../ nextnothing nextnothing2 nextnothing3 $
The default values of legion_import_tree are the current Unix directory and the current Legion context (in this case, the home context "."), but you can specify the desired directory path and/or context path.
Note that Legion creates a new context called /nextlevel and copies the contents of the /nextlevel subdirectory into the new context.
$ legion_import_tree legion.practice Making legion context "./nextlevel" Creating context "nextlevel" in parent ".". New context LOID = "1.01.05.47b53908.000001fc0c01650..." Copying contents of "legion.practice/nextlevel" "./nextlevel" Copying unix file "legion.practice/nextlevel/nextnothing" to legion file "./nextlevel/nextnothing" Copying unix file "legion.practice/nextlevel/nextnothing2" to legion file "./nextlevel/nextnothing2" Copying unix file "legion.practice/nextlevel/nextnothing3" to legion file "./nextlevel/nextnothing3" Copying unix file "legion.practice/nothing" to legion file "./nothing" Copying unix file "legion.practice/nothing2" to legion file "./nothing2" Copying unix file "legion.practice/nothing3" to legion file "./nothing3" $
The legion_cat command shows that the file objects contain the same information as the Unix files.
$ cat legion.practice/nextlevel/nextnothing3
3: This is a test, just a test, nothing more.
$ legion_cat nextnothing3
3: This is a test, just a test, nothing more.
$
2. Full path syntax can be used as well as relative syntax in all Legion commands.[Back]
3. In the interests of space and readability, in this and some of the following examples the entire LOID is not reproduced.[Back]
Last modified: Tue May 2 16:59:42 2000
|
[Testbeds] [Et Cetera] [Map/Search]
legion@Virginia.edu
|