>12/05/00 19:00:38 ANS1194E Specifying the schedule log
>'/usr/tivoli/tsm/client/ba/bin/dsmsched.log' as a symbolic link is not
>allowed.
Ron - I wonder if one of the subdirectories in that path is a symbolic
link. Below is a handy-dandy Perl program I wrote which makes
it easy to discern path elements.
Richard Sims, BU
-----------------------
#!/usr/local/bin/perl
#!/usr/local/bin/perl
#
# follow-path -- to follow the elements of a path name and report on each.
#
# INVOCATION: follow-path {path_name}
#
# HISTORY:
#
# 1993/04/01 Created by Richard Sims
#
#________________________Evaluate invocation arguments_______________________
if (scalar(@ARGV) == 0)
{
print("No invocation arguments supplied; need path name.\n");
exit(1);
}
if (scalar(@ARGV) > 1)
{
print("Too many invocation arguments supplied; need just path name.\n");
exit(1);
}
$arg_path = $ARGV[0]; # Grab the one invocation argument.
#__________________________Mainline processing______________________________
print "\nFollowing path '",$arg_path,"'...\n\n";
# Split the path name into slash-delimited tokens:
@path_elements = split(/\//,$arg_path);
$elements_count = @path_elements; # Obtain count of elements obtained.
# For report formatting, find the length of the longest path element:
$max_element_length = 0;
foreach $path_element (@path_elements)
{
$l = length($path_element);
if ($l > $max_element_length) { $max_element_length = $l; }
}
$max_element_length += 2; # Allow for quotes around element.
# Report the separate elements:
$path = ""; # To start.
# Put out header:
printf(" %-${max_element_length}.${max_element_length}s ".
"____TYPE__________ ____OWNER_____ ____GROUP_____ OTHER\n"," ");
for ($i = 0; $i < $elements_count; $i++)
{
$path_element = @path_elements[$i]; # Extract, for efficiency.
# The first of the path elements will be null if the path name entered
# began with a slash, in which case we bypass the null.
if (length($path_element) > 0)
{
# Now accumulate the latest token to our path:
$prior_path = $path;
$path = $path.'/'.$path_element;
if (! -e $path)
{
print("Path '",$path,"' does not exist; quitting.\n");
exit(1);
}
else
{
#print(" In path '",$path,"':\n");
# Put out common beginning of line, to be completed later:
printf(" %-${max_element_length}.${max_element_length}s: ",
"'".$path_element."'");
($st_dev,$st_ino,$st_mode,$st_nlink,$st_uid,$st_gid,$st_rdev,$st_size,
$st_atime,$st_mtime,$st_ctime,$st_blksz,$st_blocks) = lstat($path);
#_________________________Evaluate element type________________________
if (($st_mode & 0xc000) == 0xc000) { $type = "socket "; }
elsif (($st_mode & 0xa000) == 0xa000) { $type = "symbolic link "; }
elsif (($st_mode & 0x8000) == 0x8000) { $type = "plain file "; }
elsif (($st_mode & 0x6000) == 0x6000) { $type = "block special file"; }
elsif (($st_mode & 0x4000) == 0x4000) { $type = "directory "; }
elsif (($st_mode & 0x2000) == 0x2000) { $type = "char special file "; }
elsif (($st_mode & 0x1000) == 0x1000) { $type = "fifo (named pipe) "; }
else { $type = "unknown "; }
($user_name) = getpwuid($st_uid);
($group_name) = getgrgid($st_gid);
$other_mode = chop($privs);
#_______________________Evaluate privs symbology_______________________
$privs_triplet = sprintf("%03o",$st_mode & 0x1ff);
for ($j = 0; $j < 3; $j++)
{
$priv_octal = substr($privs_triplet,$j,1);
if ($priv_octal == "7") { @privs_rwx[$j] = "rwx"; }
elsif ($priv_octal == "6") { @privs_rwx[$j] = "rw-"; }
elsif ($priv_octal == "5") { @privs_rwx[$j] = "r-x"; }
elsif ($priv_octal == "4") { @privs_rwx[$j] = "r--"; }
elsif ($priv_octal == "3") { @privs_rwx[$j] = "-wx"; }
elsif ($priv_octal == "2") { @privs_rwx[$j] = "-w-"; }
elsif ($priv_octal == "1") { @privs_rwx[$j] = "--x"; }
elsif ($priv_octal == "0") { @privs_rwx[$j] = "---"; }
}
printf("%s %-10s %s %-10s %s
%s\n",$type,"'".${user_name}."'",@privs_rwx[0],
"'".$group_name."'",@privs_rwx[1],@privs_rwx[2]);
# For a symbolic link, show where it leads:
if (($st_mode & 0xa000) == 0xa000)
{
$sym_link = readlink($path);
printf(" %-${max_element_length}.${max_element_length}s to
'%s'\n",
" ",$sym_link);
$path = $prior_path.'/'.$path_element;
}
}
}
} # end of for-loop.
print("\n"); # Some visual delineation before Unix prompt.
exit(0);
|