Created
March 28, 2025 11:37
-
-
Save prerakmody/8b6eb31f07f5daa03ca198d081146806 to your computer and use it in GitHub Desktop.
SLURM Management
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function to check the status of a service | |
check_service_status() { | |
local service=$1 | |
while true; do | |
sudo systemctl status "$service" --no-pager | |
if [ $? -eq 0 ]; then | |
break | |
fi | |
done | |
} | |
# Check the status of slurmd, slurmctld, and slurmdbd | |
echo -e "\n" | |
echo "##############################" | |
echo "Checking status of slurmd, slurmctld, and slurmdbd..." | |
echo "##############################" | |
echo -e "\n" | |
echo "##############################" | |
check_service_status slurmd | |
echo "##############################" | |
echo -e "\n" | |
echo "##############################" | |
check_service_status slurmctld | |
echo "##############################" | |
echo -e "\n" | |
echo "##############################" | |
check_service_status slurmdbd | |
echo "##############################" # Breakline | |
# Check the status of all folders in /mnt going down one tree depth | |
echo -e "\n" # Breakline | |
echo "##############################" # Breakline | |
echo "Checking number of folders in each directory under /mnt..." | |
for dir in /mnt/*/; do | |
folder_count=$(find "$dir" -maxdepth 1 -type d | wc -l) | |
# Subtract 1 to exclude the directory itself | |
folder_count=$((folder_count - 1)) | |
echo "Number of folders in $dir: $folder_count" | |
done | |
echo "##############################" # Breakline | |
echo -e "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment