Sometimes, you may want to write a simple BASH menu system to help non-Linux users. Here is a sample sample.
#!/bin/bash
clear
echo "
Welcome to GCluster User Help Menu System
===============================================
Please select:
---------------------------------------------------
1. Display Current Logged Session(s)
2. Display Current Home Space Utilisation
3. Check Running Process(s)
4. Check my Project Funds
5. Check for ABAQUS Licenses
6. Check for MATLAB Distributed Compute Licenses
7. Check for ANSYS Licenses
8. List running jobs from Project Members
0. Quit
---------------------------------------------------
"
read -p "Enter selection [0-8] > "
if [[ $REPLY =~ ^[0-8]$ ]]; then
if [[ $REPLY == 0 ]]; then
echo "Program Terminated."
exit
fi
if [[ $REPLY == 1 ]]; then
echo "Logged session: "
w |grep $USER
exit
fi
if [[ $REPLY == 2 ]]; then
echo "Home Space Utilisation ($USER):"
echo "(Please be patient.... It will take a while)"
du -sh $HOME
exit
fi
if [[ $REPLY == 3 ]]; then
echo "Check my Running Processes on Login Node:"
top -u $USER
exit
fi
if [[ $REPLY == 4 ]]; then
module load ams
read -p "Enter your Project ID: " project_id
project_summary $project_id
exit
fi
if [[ $REPLY == 5 ]]; then
clear
check_license_abaqus.sh
exit
fi
if [[ $REPLY == 6 ]]; then
clear
check_license_matlab.sh
exit
fi
if [[ $REPLY == 7 ]]; then
clear
check_license_ansys.sh
exit
fi
if [[ $REPLY == 8 ]]; then
read -p "Enter your Project ID: " project_id
countjobs=`qselect -P $project_id |wc -l`
if [[ $countjobs -gt 0 ]]; then
qstat -ans `qselect -P $project_id`
exit
else
echo "No Running Projects"
fi
fi
else
echo "Invalid entry." >&2
exit 1
fi