Il 26/05/2011 09:23, Marcello Romani ha scritto:
> Hi,
>       I'd like to share a tip about shutting down a windows client after
> its backuò job has finished.
> Nothing spectacular, but I guessed somebody would find it useful.
>
> 1) Create a batch file with a suitable name, e.g. C:\shutdown.bat
> 2) Put this single line in it:
>
> shutdown -s -t 0
>
> which simply means halt the system (-s) and do it now (-t 0).
>
> Then in bacula-dir.conf on the host where bacula director runs, edit the
> job resource of the windows client and add this line:
>
> ClientRunAfterJob = "C:/shutdown.bat"
>
> The client machine whill shutdown immediataly after the backup job has
> finished.
>
> Disclaimer: I haven't tested this with unsaved documents open...
>
> HTH
>

Some random thoughts after reading the comments to my initial message:

- don't use a batch file, but include the commands directly in the 
bacula-dir.conf directive. This has the advantage of keeping the 
information all in one place instead of spreading it on all of the 
clients (plus you don't have to backup those .bat files);

- stop antivirus with Client Run Before Job directive

- use "& exit /b 0" to avoid interrupting the job if some of the 
previous commands (e.g. net stop antivirus) fails for some reason (a 
slow backup is better than no backup);

- delay shutdown somewhat to let bacula-fd close the job properly;

- use -f option in shutdown to force closing open applications.

- remember the difference between RunAfterJob and ClientRunAfterJob 
(guess how I found that out... ;-)


Let's recap:

ClientRunBeforeJob = "<antivirus stop command> & exit /b 0"
ClientRunAfterJob = "shutdown -s -t 30 -f & exit /b 0"

Thanks everybody for the useful suggestions.

-- 
Marcello Romani

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to