#!/bin/sh ############################################################################# # alifs - a front-end shell for CASTOR and SHIFT ############################################################################# # # modification history # $Log$ # Revision 1.1 2001/02/23 17:33:40 buncic # Added alifs wrapper for CASTOR and alirun modified accordingly. # # # SYNOPSIS # alifs [flags] # # File System implementation: # ls [-cdilRu] path # mv oldname newname... # rm [-f] [-i] [-r] dirname... # mkdir [-m absolute_mode] [-p] dirname... # cp f1 f2 # cp f1 # # CASTOR implementation: # ls [-cdilRTu] [--class] [--comment] path # mv oldname newname... # rm [-f] [-i] [-r] dirname... # mkdir [-m absolute_mode] [-p] dirname... # cp [-s maxsize] f1 f2 # cp f1 # # DESCRIPTION # This is an interface script to underlying mass storage manager. At present it supports CASTOR on RH6.1 and offers some basic Unix like commands: # # o) list directory # alifs ls [-cdilRTu] [--class] [--comment] path # # o) move (rename) file or directory # alifs mv oldname newname... # # o) remove file or directory # alifs rm [-f] [-i] [-r] dirname... # # o) create directory # alifs mkdir [-m absolute_mode] [-p] dirname... # o) copy files # alifs cp [-s maxsize] f1 f2 # alifs cp f1 # # CASTOR file system is accessible via RFIO (root must be configured configured with --enable-rfio switch and linked with appropriate libshift.a library). It provides experiment topl level directory (/castor/cern.ch/alice) and user directories following the AFS naming scheeme (like /castor/cern.ch/user/b/buncic). #For more info on CASTOR commands, see related man pages (nsls, nsrename, nsrm, nsmkdir,rfcp,rfstat). # # # AUTHOR: # Predrag Buncic, e-mail: Predrag.Buncic@cern.ch # # CREATION DATE: # 15-Feb-2001 #C< ########################################################################### ALIFSDIR=`dirname $0`; export ALIFSDIR ########################################################################### Configure() { case "$ALICE_MSS" in CASTOR) if [ -f $ALIFSDIR/castor.sh ] then . $ALIFSDIR/castor.sh else printf "Cannot find %s file. Terminating..." $ALIFSDIR/castor.sh exit 1 fi ;; HPSS|RFIO) if [ -f $ALIFSDIR/rfio.sh ] then . $ALIFSDIR/rfio.sh else printf "Cannot find %s file. Terminating...\n" $ALIFSDIR/rfio.sh exit 1 fi ;; *) ;; esac if [ "$EXEC_SHELL" = "" ] then EXEC_SHELL=bin/sh for shell in bash zsh ksh do for dir in /bin /usr/bin /usr/local/bin do if [ -x $dir/$shell ] then EXEC_SHELL=$dir/$shell break 2 fi done done export EXEC_SHELL exec $EXEC_SHELL -norc -noprofile $0 $* fi } ########################################################################### ALIFS_Usage() { printf "\nFile System Implementation:\n\n" printf "Usage: alifs [-help][-p ] \n" printf " [-cdilRu] path \n" printf " mv oldname newname... \n" printf " rm [-f] [-i] [-r] dirname... \n" printf " mkdir [-m absolute_mode] [-p] dirname...\n" printf " cp f1 f2 \n" printf " cp f1 \n" exit } ########################################################################### ALIFS_Makeman() ########################################################################### { mandir=../man/man4 ./mangen -n tool $0 if [ $? -eq 0 ] then [ ! -d $mandir ] && mkdir -p $mandir mv `basename $0`.? $mandir exit fi } ########################################################################### ALIFS_ls() { ls $* } ########################################################################### ALIFS_mkdir() { mkdir $* } ########################################################################### ALIFS_mv() { mv $* } ########################################################################### ALIFS_rm() { rm $* } ########################################################################### ALIFS_cp() { cp $* } ########################################################################### Configure $* ########################################################################### ALIFS() { cmd=$1; shift 1 case `type -t ALIFS_$cmd` in function) ALIFS_$cmd $* ;; *) ALIFS_Usage; ;; esac exit } ########################################################################### ########################################################################### for param in $* do case $param in -trace) shift 1 set -vx ;; -echo) shift 1 ECHO="echo " ;; -makeman) shift 1 ALIFS_Makeman ;; -help) ALIFS_Usage ;; -p) shift 1 POOL=$1; shift 1 ;; *) ALIFS $* ;; esac done ########################################################################### ALIFS_Usage ###########################################################################