Commit 8898b3cd authored by Kerri Wait's avatar Kerri Wait
Browse files

Fixes to symlink script

parent d627e443
#!/bin/bash
orgnlfs={{ lustrefs }}
symlnkdst={{ localdir }}
originallfs={{ lustre_mount }}/{{ lustre_storage_type }}
symlinkdest={{ local_directory_path }}/{{ lustre_storage_type }}
# Check that original lustre filesystem is mounted, exit if it isn't
if [ ! -d $orgnlfs ]; then
if [ ! -d $originallfs ]; then
exit 1
fi
# Check that the symlink destination exists, has the correct permissions etc
if [ ! -d $symlnkdst ]; then
echo "Creating $symlnkdst as it does not exist yet";
mkdir -p $symlnkdst;
chown root:root $symlnkdst;
chmod 0755 $symlnkdst;
if [ ! -d $symlinkdest ]; then
echo "Creating $symlinkdest as it does not exist yet";
mkdir -p $symlinkdest;
chown root:root $symlinkdest;
chmod 0755 $symlinkdest;
fi
# Iterate over directories inside the original fs, create symlinks if they do _not_ exist
for subpath in `ls -1d "$orgnlfs"/*`; do
for subpath in `ls -1d "$originallfs"/*`; do
foldername=`basename "$subpath"`;
linkpath="$symlnkdst/$foldername";
linkpath="$symlinkdest/$foldername";
if [ ! -L $linkpath ]; then
#echo "Symlink does not exist";
ln -sT $subpath $linkpath;
......
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