Bacula-users

Re: [Bacula-users] Automatic restore script issues

2017-03-10 14:56:48
Subject: Re: [Bacula-users] Automatic restore script issues
From: Wanderlei Huttel <wanderleihuttel AT gmail DOT com>
To: Heitor Faria <heitor AT bacula.com DOT br>
Date: Fri, 10 Mar 2017 16:55:57 -0300
There is another alternative, but I don't know if will works. You need to try

################################
#!/bin/bash
var="$(cat <<EOF
restore before=\"2017-01-30 08:00:00\" client=mx5-fd restoreclient=finlay-fd where=/mnt/externo/bacula/bacula/archives/restore/mx5 select all done yes
3
EOF
)"
echo "$var" | /usr/bin/bconsole


Best Regards

Wanderlei Hüttel

2017-03-10 16:19 GMT-03:00 Heitor Faria <heitor AT bacula.com DOT br>:
Hello, Reinier,

Hello, I am trying to do an automatic restore script, but I am having this issues:
# vim restore

bin/echo "restore select all before=2017-01-30\ 08:00:00 client=mx5-fd restoreclient=finlay-fd where=/mnt/externo/bacula/bacula/archives/restore/mx5 done select yes" | /usr/bin/bconsole


when i call the script like this

#./restore

i show me this:

Connecting to Director bacula-dir.red.sld.cu:9101
1000 OK: bacula-dir Version: 5.2.6 (21 February 2012)
Enter a period to cancel a command.
restore select all before=2017-01-30\ 08:00:00 client=mx5-fd restoreclient=finlay-fd where=/mnt/externo/bacula/bacula/archives/restore/mx5 done select yes
Using Catalog "MyCatalog"
Automatically selected FileSet: Standard Set
+---------+-------+----------+-------------+---------------------+------------+
| JobId   | Level | JobFiles | JobBytes    | StartTime           | VolumeName |
+---------+-------+----------+-------------+---------------------+------------+
| 248,718 | F     |    6,163 | 972,780,649 | 2017-03-06 23:30:30 | VA0203L3   |
| 248,874 | I     |       51 | 743,483,652 | 2017-03-07 16:09:19 | VA0208L3   |
| 249,030 | I     |       52 | 743,678,821 | 2017-03-08 02:00:02 | VA0208L3   |
| 248,956 | I     |       52 | 743,678,821 | 2017-03-08 02:00:14 | Vol_0069   |
| 249,113 | I     |       12 | 682,442,777 | 2017-03-08 19:38:26 | Vol_0078   |
| 249,189 | I     |       13 | 682,462,601 | 2017-03-08 20:32:25 | VA0208L3   |
| 249,273 | I     |      116 | 744,181,376 | 2017-03-09 17:58:42 | Vol_0066   |
| 249,349 | I     |      114 | 744,194,144 | 2017-03-09 18:54:46 | VA0208L3   |
| 249,433 | I     |       45 | 744,406,590 | 2017-03-10 07:26:33 | Vol_0068   |
| 249,509 | I     |       47 | 744,418,911 | 2017-03-10 08:05:28 | VA0208L3   |
+---------+-------+----------+-------------+---------------------+------------+
Automatically selected FileSet: Standard Set
+---------+-------+----------+-------------+---------------------+------------+
| JobId   | Level | JobFiles | JobBytes    | StartTime           | VolumeName |
+---------+-------+----------+-------------+---------------------+------------+
| 239,350 | F     |    6,137 | 803,816,815 | 2017-01-01 12:59:17 | VA0217L3   |
| 243,317 | D     |      172 | 590,776,475 | 2017-01-29 18:36:07 | VA0192L3   |
+---------+-------+----------+-------------+---------------------+------------+
You have selected the following JobIds: 239350,243317

Building directory tree for JobId(s) 239350,243317 ...  Bootstrap records written to /var/lib/bacula/bacula-dir.restore.7.bsr

The job will require the following
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================

   *VA0217L3                  MSL6000                   Drive-0                 
   *VA0192L3                  MSL6000                   Drive-0                 

Volumes marked with "*" are online.


6,309 files selected to be restored.

The defined Restore Job resources are:
     1: RestoreFiles EVA
     2: RestoreFiles
     3: RestoreFilesExterno
Select Restore Job (1-3):

But in this point it return me to bash, I need a way to select one of this defined Restore Job resources,
You don't really need multiple Restore Jobs configured in bacula-dir.conf. Anyway, I'm not sure if you have a keyword for this if you need to choose one of the above (v.g.: job=): http://www.bacula.org/5.1.x-manuals/en/main/main/Restore_Command.html

Regards,
The defined Restore Job resources are:
     1: RestoreFiles EVA
     2: RestoreFiles
     3: RestoreFilesExterno
Select Restore Job (1-3):

for example I want to choose number 3, what I could do? Any suggestions? Thanks in advanced.

--
===========================================================================
Heitor Medrado de Faria  | Bacula do Brasil
• Não seja tarifado pelo tamanho dos seus backups, conheça o Bacula Enterprise: http://www.bacula.com.br/enterprise/
 Ministro treinamento e implementação in-company do Bacula Community: http://www.bacula.com.br/in-company/
(61) 98268-4220 | www.bacula.com.br 
============================================================================
Indicamos também as capacitações complementares:
 Shell básico e Programação em Shell com Julio Neves.
 Zabbix com Adail Host.
============================================================================

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
<Prev in Thread] Current Thread [Next in Thread>