Quantcast
Channel: Recent Gists from vsoch
Viewing all articles
Browse latest Browse all 30

An example of setting a custom environment variable already defined in the container

$
0
0
Singularity
Bootstrap: docker
From: centos:7
# sudo singularity build lamps.simg Singularity
%environment
now=`date '+%Y_%m_%d'`
hostname=`hostname`
APPNAME="lammps"
RESULTS_DIR=${HOME}/${APPNAME}
LOG="${hostname}_${APPNAME}_${now}"
RESULTS="${hostname}_${APPNAME}_${now}.results"
SYSCONFIG="${hostname}_${APPNAME}_${now}.sysconfig"
APPINFO="${hostname}_${APPNAME}_${now}.appinfo"
export APPNAME LOG RESULTS SYSCONFIG APPINFO now hostname RESULTS_DIR
%apprun lammps
echo "${SCIF_APPNAME} is running."
WORKDIR=${SCIF_APPROOT}
if [ -n "$CUSTOM_RESULTS_DIR" ]; then
RESULTS_DIR=$CUSTOM_RESULTS_DIR
else
RESULTS_DIR=${HOME}/${APPNAME}
fi
if [ ! -x "$RESULTS_DIR" ]; then
mkdir -p $RESULTS_DIR
fi
cd $WORKDIR
echo "Single node Output file is $RESULTS and log is $LOG and results dir is $RESULTS_DIR" |tee $RESULTS_DIR/$RESULTS
%post
yum install -y sudo wget vi which
yum install -y hostname lscpu uptime redhat-lsb

Viewing all articles
Browse latest Browse all 30

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>