SDSU CS 696 Emerging Technologies: Distributed Objects
Spring Semester, 1998
Shared BeanBox Problem

To Lecture Notes Index
© 1998, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 15-May-98

Contents of Doc 37, Shared BeanBox Problem

  1. Shared BeanBox Problem
References

Private communication with Stewart Stremler

Doc 37, Shared BeanBox Problem Slide # 2

Shared BeanBox Problem


There is a problem using the beanbox on rohan

The beanbox creates temporary files when it is running

It uses the directory /opt/BDK/beanbox/tmp to write its temporary files

On rohan the directory /opt/BDK/beanbox/tmp is a symbolic link to /var/tmp

The contents in /var/tmp are removed periodically

Also you have a separate quota for files in /var/tmp, so files you put there don't count against your normal file quota

In general having /opt/BDK/beanbox/tmp linked to /var/tmp is a good thing

However, there is one problem

Under some conditions the beanbox will create a subdirectory of /opt/BDK/beanbox/tmp (which makes it a subdirectory of /var/tmp)

When it does this, the subdirectory is owned by the person who was running the beanbox, which means when someone else runs the beanbox, it can not write in that subdirectory! So the beanbox will not work!!

Doc 37, Shared BeanBox Problem Slide # 3
A Solution from Stremler

A solution is to create a directory in your own account to run the beanbox

However, the beanbox is to big for you to copy in your student accounts

So the idea is to create the a directory for the beanbox in your account, but create symbolic links to all the beanbox files

But we still need to link the beanbox temp directory to /var/tmp

To avoid the one student creating the beanbox temp files that other students beanbox can not use, we link the beanbox temp directory to /var/tmp/userName where userName is your user name.

This gives everyone a different temp location for their beanbox

Now this might seem a bit complex, so below there is a program which will do this for you


Doc 37, Shared BeanBox Problem Slide # 4
Stremler's Program
#!/bin/csh -f
#

mkdir BDK
cd BDK

mkdir beanbox
cd beanbox
foreach i (/opt/BDK/beanbox/*)
   set j = `basename $i`
   echo "linking $j to $i"
   ln -s $i $j
end
rm tmp
# note that this temp directory will need to be maintained
mkdir /var/tmp/${USER}-tmp
ln -s /var/tmp/${USER}-tmp tmp
cd ..

mkdir jars
cd jars
foreach i (/opt/BDK/jars/*)
   set j = `basename $i`
   echo "linking $j to $i"
   ln -s $i $j
end


Doc 37, Shared BeanBox Problem Slide # 5
Using Stremler's Program

Now you can put the program into a file, make the file executable and then execute it in your home directory

Or on rohan you can just run the program ~whitney/bin/makeBeanBox

You will have a directory BDK/beanbox in your home directory from which you run the beanbox without the original problem

Since all the files are just links, this will not take much space
Another Problem

Given the above setup, your beanbox will use the directory /var/tmp/userName-tmp

However, after a few days this directory will be removed

When this happens the beanbox will not work

So you need to recreate the directory with the proper links to it

One could just rerun Stremler program

Or one could put the following lines in your .login or .cshrc file to create the directory automatically every time you login
if ! -e /var/tmp/${USER}-tmp then
   mkdir /var/tmp/${USER}-tmp
   ln -s /var/tmp/${USER}-tmp BDK/beanbox/tmp
endif

As Stewart points out the line ln in the above is not really needed, since the orginal link should still exist. So the following will work:
if ! -e /var/tmp/${USER}-tmp then
   mkdir /var/tmp/${USER}-tmp
endif

Copyright © 1998 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
All rights reserved.

visitors since 15-May-98