From b892cbf758e520b55d7a25bc690de717e60dc50d Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Thu, 16 May 2019 16:59:14 +0100 Subject: [PATCH] refined the script --- mcluster_script.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/mcluster_script.sh b/mcluster_script.sh index 834f9bd..b8e9f2b 100755 --- a/mcluster_script.sh +++ b/mcluster_script.sh @@ -1,16 +1,36 @@ #!/bin/bash + +##### +# Script to execute mcluster to set up inital settings for a cluster. +# Useage: run the script. Change the values of NAME_RUN, MCLUSTER_COMMANDS and TARGET_DIR to your liking. After running this script you can use the output to feed it to nbody6 +###### + # TODO: -# rename the files # Check if dir exists. +# Dont change these settings MCLUSTER_CONFIG_DIR='/vol/ph/astro_code/dhendriks/work_dir/mcluster' MCLUSTER_EXECUTABLE='/vol/ph/astro_code/dhendriks/mcluster/mcluster' -NAME_RUN='test' + +# Change these settings +TARGET_DIR=$MCLUSTER_CONFIG_DIR +NAME_RUN='test' # Store settings for mcluster in here. MCLUSTER_COMMANDS="-C0 -o" +# Check if dir is empty: if not: empty it +DIR="test" +if [ "$(ls -A $TARGET_DIR)" ]; then + echo "Take action $TARGET_DIR is not Empty" + echo "Deleting content:" + rm $TARGET_DIR/* +else + echo "$TARGET_DIR is Empty" +fi + +# Execute mcluster cmd $MCLUSTER_EXECUTABLE $MCLUSTER_COMMANDS $MCLUSTER_CONFIG_DIR/$NAME_RUN | tee $MCLUSTER_CONFIG_DIR/$NAME_RUN.summary # Write command to file -- GitLab