ntrogers
9/11/2017 - 9:27 PM

[Bacula] #Bacula #nix

[Bacula] #Bacula #nix

jobIds=`echo 'status dir running' | bconsole | fgrep 'is waiting' | awk '{print $1}'`
for i in $jobIds
do
    if [ -z `echo "$i" | grep '^[0-9]\+$'` ]
    then
        echo "Error: job ID $i is not a number!"
    else
        echo "Killing waiting Bacula job $i"
        echo "cancel jobid=$i" | bconsole
    fi
done
clients=`mysql -e'select Name from Client ORDER BY Name ASC;' bacula | tail -n+2`
for client in `echo $clients`
do
  echo "prune files client=${client} yes" | bconsole
done