Skip to content

Instantly share code, notes, and snippets.

@s-sajid-ali
Created May 19, 2025 14:36
Show Gist options
  • Save s-sajid-ali/7ededa5832895eabce15974d04f85b84 to your computer and use it in GitHub Desktop.
Save s-sajid-ali/7ededa5832895eabce15974d04f85b84 to your computer and use it in GitHub Desktop.
slurm-ingest-from-dump
# basic version from claude-3.7
#!/bin/bash
# Define the dump file path
DUMP_FILE="/slurm-dump/f-k8s-dev.cfg"
# Function for error handling
handle_error() {
local exit_code=$1
local error_message=$2
echo "Error: ${error_message}" >&2
exit ${exit_code}
}
# Check if the dump file exists
if [ -f "$DUMP_FILE" ]; then
# Try to print the file
if ! /opt/slurm/bin/sacctmgr load "$DUMP_FILE"; then
handle_error 1 "Failed to load the dump file."
fi
# Try to remove the file
if ! rm "$DUMP_FILE"; then
handle_error 2 "Failed to remove the dump file."
fi
echo "Dump file was printed and removed successfully."
exit 0
else
echo "Dump file does not exist."
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment