Community-Contributed Scripts
Scripts contributed by NowWhat users for common workflows.
This section collects useful scripts shared by users that may also be helpful for others. You can find all code and scripts files at this NowWhat repository.
RStudio Server Script by vreffo
Use RStudio Server on a compute node using the apptainer-rstudio-server module.
#!/bin/bash
#SBATCH --job-name=start_rstudioserver
#SBATCH --partition=cpu
#SBATCH --time=10:00:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=10
#SBATCH --mem=40G
#SBATCH --output=slurm-%j.out
#SBATCH --error=slurm-%j.err
# specify the paths of the out and err to have them created in a sensible position
set -euo pipefail
# Specify the PORT number for rstudio
RSTUDIO_PORT="${PORT:-8787}"
echo "Job ID: $SLURM_JOB_ID"
echo "Host: $(hostname)"
echo "Start time: $(date)"
echo "Starting RStudio Server on port: $RSTUDIO_PORT"
# Load the required environment
module purge
module load apptainer-rstudio-server
# Start rstudio server on the compute node
rstudio --ip 0.0.0.0 --port "$RSTUDIO_PORT"Usage notes:
- Create new file
nano vreffo-slurm-rstudio.sh. - Submit it with
sbatch vreffo-slurm-rstudio.sh. - You can override the default port by setting
PORT, for example:PORT=8888 sbatch vreffo-slurm-rstudio.sh.