Commit 2f5862df authored by Kerri Wait's avatar Kerri Wait
Browse files

Jinja template for symlink creation script

parent e76d9f86
#!/bin/bash
orgnlfs={{ lustrefs }}
symlnkdst={{ localdir }}
# Check that original lustre filesystem is mounted, exit if it isn't
if [ ! -d $orgnlfs ]; 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;
fi
# Iterate over directories inside the original fs, create symlinks if they do _not_ exist
for subpath in `ls -1d "$orgnlfs"/*`; do
foldername=`basename "$subpath"`;
linkpath="$symlnkdst/$foldername";
if [ ! -L $linkpath ]; then
#echo "Symlink does not exist";
ln -sT $subpath $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