Commit 64778342 authored by Kerri Wait's avatar Kerri Wait
Browse files

Cleaning up symlinker.sh with clearer variable names and better find command instead of ls

parent 4cec637f
......@@ -5,6 +5,7 @@ symlinkdest={{ local_directory_path }}/{{ lustre_storage_type }}
# Check that original lustre filesystem is mounted, exit if it isn't
if [ ! -d $originallfs ]; then
echo "Check that the filesystem $originalfs is mounted, exiting...";
exit 1
fi
......@@ -17,11 +18,10 @@ if [ ! -d $symlinkdest ]; then
fi
# Iterate over directories inside the original fs, create symlinks if they do _not_ exist
for subpath in `ls -1d "$originallfs"/*`; do
foldername=`basename "$subpath"`;
for sourcepath in `find "$originalfs" -maxdepth 1 -mindepth 1 -type d`; do
foldername=`basename "$sourcepath"`;
linkpath="$symlinkdest/$foldername";
if [ ! -L $linkpath ]; then
#echo "Symlink does not exist";
ln -sT $subpath $linkpath;
ln -sT $sourcepath $linkpath;
fi
done
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment