Skip to content

Instantly share code, notes, and snippets.

@ntrogers
Last active September 28, 2017 00:03
Show Gist options
  • Save ntrogers/34775fda411edc1b108c0cb1f69608f8 to your computer and use it in GitHub Desktop.
Save ntrogers/34775fda411edc1b108c0cb1f69608f8 to your computer and use it in GitHub Desktop.
[Bacula] #Bacula #nix
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment