Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:18

0001 #!/bin/bash
0002 
0003 # Default named pipe path
0004 DEFAULT_PIPE="/tmp/jana_status"
0005 
0006 # Check for required arguments
0007 if [[ $# -lt 1 ]]; then
0008     echo "Usage: $0 <PID> [jana_status_pipe]"
0009     exit 1
0010 fi
0011 
0012 # Assign variables
0013 PID="$1"
0014 PIPE="${2:-$DEFAULT_PIPE}" # Use the second argument if provided, otherwise use the default
0015 
0016 # Validate the PID
0017 if ! kill -0 "$PID" 2>/dev/null; then
0018     echo "Error: Process with PID $PID does not exist."
0019     exit 1
0020 fi
0021 
0022 # Check if the pipe exists
0023 if [[ ! -p "$PIPE" ]]; then
0024     echo "Error: Named pipe '$PIPE' does not exist."
0025     exit 1
0026 fi
0027 
0028 # Send the USR1 signal to the process
0029 if ! kill -USR1 "$PID"; then
0030     echo "Error: Failed to send SIGUSR1 to PID $PID."
0031     exit 1
0032 fi
0033 
0034 # Cat the named pipe
0035 cat "$PIPE"