Archive

HowTo: Cómo resetear bacula?

Hay una bronca; resetear bacula! Es una weba. Hay que apagar como mil servicios y borrar unas madres y bla bla bla...

Ahí les va un script, para webones como yo! Ponlo en /usr/local/libexec/bacula y lo corres con su -c '/usr/local/libexec/bacula/resetBacula'

#!/bin/bash

# check if it's the authorized user; which is the local user.
if [ $(id -u) != 0 ]; then
    echo -e "Córrelo como root! O, también, puedes usar su -c 'resetBacula'"
    exit 1
fi

# stop bacula
echo "Stopping bacula..."
service bacula-dir stop
service bacula-fd stop
service bacula-sd stop

# reset DB
echo -e "\nReseting DB..."
/usr/libexec/bacula/drop_mysql_database
/usr/libexec/bacula/create_mysql_database
/usr/libexec/bacula/make_mysql_tables

# remove state and bsr files
echo -e "\nRemoving state and bsr files..."
rm -f /var/spool/bacula/*.{bsr,state}

# remove backup volumes
echo -e "\nRemoving volume files..."
rm -f /var/backup/bacula/*

# restart bacula
echo -e "\nRestarting bacula..."
service bacula-sd start
service bacula-fd start
service bacula-dir start

exit 0

Permisos recomendados:

su -c 'chmod 1700 /usr/local/libexec/bacula/resetBacula'

GPLv3 all the way, my friends! Úsenlo y háganle lo que se les inche...