diff --git a/mcluster_script.sh b/mcluster_script.sh index 834f9bd2cc454f98b364cbf8072d646bbf0aa93a..b8e9f2b618708a987015b4a94c52c9a1c3f4da65 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