Created
          May 19, 2025 14:36 
        
      - 
      
 - 
        
Save s-sajid-ali/7ededa5832895eabce15974d04f85b84 to your computer and use it in GitHub Desktop.  
    slurm-ingest-from-dump
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | # 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