Skip to content
Snippets Groups Projects
Secator.sh 603 B
Newer Older
Theodore Efremov's avatar
Theodore Efremov committed
#!/bin/bash


#launch job in parralel
MAX_JOBS=25  # Maximum parallel jobs
SEMAPHORE="job_semaphore"

# Create a named pipe (FIFO) for job control
mkfifo $SEMAPHORE
exec 3<> $SEMAPHORE
rm $SEMAPHORE

# Pre-fill the semaphore with tokens equal to MAX_JOBS
for ((i=0; i<MAX_JOBS; i++)); do
    echo "" >&3
for run in {201..262}; do
Theodore Efremov's avatar
Theodore Efremov committed
    read -u 3  # Wait for an available slot
    {
        root -l -q "./Secator.C(\"/home/efremovt/Data/2to_SSD/2024/np_raw/run_raw_"$run".root\",\"output/run_"$run"/\", 30)"
        echo "" >&3  # Release the slot
    } & 
done

wait

exec 3>&- #close semaphore