Thank you Heitor, yes that’s the trick to build the restore list.

From: Heitor Faria [mailto:hei...@bacula.com.br]
Sent: Monday, August 8, 2016 15:09
To: Jan Gazda <jan.ga...@sapienzaconsulting.com>
Cc: bacula-users@lists.sourceforge.net
Subject: Re: [Bacula-users] Bacula Version: 5.2.13 - automatic restore folder 
script

Hello, Jan,

I'm not sure if this is what you want (requires testing):

#!/bin/bash
#
# /etc/bacula/scripts/automaterestore.sh
#

# Restore parameters:
includedir="/etc/random/path"
logFile=log.txt
client="some_client-fd"
JobId=123
restoreDestination=”/tmp/restored”

# Finds what files from includedir can be restored.
echo "list files jobid=9" | \
bconsole | \
cut -f 2 -d "|" | \
tail -n +10 | \
head -n -6 | \
grep "$includedir" \
> /tmp/restorelist.txt

# Submits restore.
bconsole <<END_OF_DATA
@output $logFile
restore client=$client jobid=$JobId where=$restoreDestination 
restoreclient=$client file=</tmp/restorelist.txt done yes
wait
messages
@output
quit
END_OF_DATA

####################################################################

Regards,

________________________________
From: "Jan Gazda" 
<jan.ga...@sapienzaconsulting.com<mailto:jan.ga...@sapienzaconsulting.com>>
To: 
bacula-users@lists.sourceforge.net<mailto:bacula-users@lists.sourceforge.net>
Sent: Thursday, August 4, 2016 6:09:52 AM
Subject: [Bacula-users] Bacula Version: 5.2.13 - automatic restore folder       
 script
Hi everybody,
I’m trying to run automatic restore script for testing purposes with bacula.
And I’m not able to pass the directory into a bconsole restore command, I found 
the way how to pass the file there even list of files but not the specific 
directory:

Is it possible to change the “file” for the directory?
Thank you,
Jan

Example.sh:
fileToRestore=”/home/user/.bash_history”
logFile=log.txt
client_to_restore='myMachine'
client_where_restore=$client_to_restore
JobId=123
restoreDestination=”tmp/restored/”

bconsole <<END_OF_DATA
@output $logFile
restore client=$client_to_restore jobid=$JobId where=$restoreDestination 
restoreclient=$client_where_restore file=$fileToRestore done
yes
wait
messages
@output
quit
END_OF_DATA


[Sapienza Logo]<http://www.sapienzaconsulting.com/>

Jan Gazda
ECLIPSE & Office IT Support Technician
Sapienza Consulting
Kapteynstraat 1
2201 BB Noordwijk
Netherlands
Tel: +31 (0) 71 407 6518
Fax: +31 (0) 71 407 6536
Mob:

Follow us on:
[Linkedin]<http://www.linkedin.com/company/sapienza-consulting>[Twitter]<https://twitter.com/sapienzajobs>[YouTube]<https://www.youtube.com/channel/UCq2Pzj4-xGZYPtLQhPr7hzw>




--
=======================================================================
Heitor Medrado de Faria  | Bacula do Brasil
Próximas aulas telepresencial ao-vivo: http://www.bacula.com.br/agenda/
Ministro treinamento e implementação in-company Bacula: 
http://www.bacula.com.br/in-company/
61 <tel:%2B55%2061%202021-8260> 8268-4220<tel:%2B55%2061%208268-4220>
Site: www.bacula.com.br<http://www.bacula.com.br/>
========================================================================


[Sapienza Logo]<http://www.sapienzaconsulting.com/>     Jan Gazda
ECLIPSE & Office IT Support Technician
Sapienza Consulting
Kapteynstraat 1
2201 BB Noordwijk
Netherlands
Tel: +31 (0) 71 407 6518
Fax: +31 (0) 71 407 6536
Mob:

Follow us on:
[Linkedin]<http://www.linkedin.com/company/sapienza-consulting>[Twitter]<https://twitter.com/sapienzajobs>[YouTube]<https://www.youtube.com/channel/UCq2Pzj4-xGZYPtLQhPr7hzw>


The contents of this e-mail and any attachment are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email and/or any attachment in error, please notify the 
sender immediately and then delete it. If you are not the intended recipient, 
you must not distribute, disclose, use, copy, print or rely on this e-mail.

Communicating by email is not 100% secure, error or virus free. It is your 
responsibility to ensure that viruses do not adversely affect your system. If 
you communicate with us by e-mail you agree to take appropriate measures to 
minimise these risks when e-mailing us.

We may monitor, record, store and use any email communication with you in order 
to check any instructions given to us, for training purposes, for crime 
prevention, to improve the quality of our customer service and to keep records 
of our business communications.

Sapienza Consulting Limited is a limited company registered in England and 
Wales with its registered office at 61 Rodney Street, Liverpool, Merseyside, L1 
9ER and registered number 2986023
------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to