Re: [Bacula-users] shutdown windows client after backup

2011-05-26 Thread Marcello Romani
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 = " & 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


Re: [Bacula-users] shutdown windows client after backup

2011-05-26 Thread Marcello Romani
Il 26/05/2011 11:00, Konstantin Khomoutov ha scritto:
> On Thu, 26 May 2011 09:23:22 +0200
> Marcello Romani  wrote:
>
>> 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.
>
> The batch file is not needed:
> Client Run After Job = "shutdown -r -t 30 -f&  exit /b 0"
> works just fine for us.
>
> We use -t 30 because otherwise sometimes shutdown does its job so fast,
> bacula-fd fails to report its completion which marks the whole job as
> failed.
>
> That "exit /b 0" trick is not strictly needed here but is anyway useful
> for running other commands (for instance, on Windows machines we stop
> the antivirus program before making the backup and start it
> afterwards--otherwise the performance is horrible) which for some
> reason may fail and we do not want it to fail the whole backup job as a
> consequence.

Thanks for the tips.

-- 
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


Re: [Bacula-users] shutdown windows client after backup

2011-05-26 Thread Marcello Romani
Il 26/05/2011 09:51, J. Echter ha scritto:
> Am 26.05.2011 09:23, schrieb Marcello Romani:
>> 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
>>
> also you can start and stop services with net stop and net start.
>
> cheers.
>
> --
> 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

Thank you for reminding me that useful bit.

-- 
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


Re: [Bacula-users] shutdown windows client after backup

2011-05-26 Thread Konstantin Khomoutov
On Thu, 26 May 2011 09:23:22 +0200
Marcello Romani  wrote:

> 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.

The batch file is not needed:
Client Run After Job = "shutdown -r -t 30 -f & exit /b 0"
works just fine for us.

We use -t 30 because otherwise sometimes shutdown does its job so fast,
bacula-fd fails to report its completion which marks the whole job as
failed.

That "exit /b 0" trick is not strictly needed here but is anyway useful
for running other commands (for instance, on Windows machines we stop
the antivirus program before making the backup and start it
afterwards--otherwise the performance is horrible) which for some
reason may fail and we do not want it to fail the whole backup job as a
consequence.

--
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


Re: [Bacula-users] shutdown windows client after backup

2011-05-26 Thread J. Echter
Am 26.05.2011 09:23, schrieb Marcello Romani:
> 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
>
also you can start and stop services with net stop and net start.

cheers.

--
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


Re: [Bacula-users] Shutdown Windows Box after backup? Howto?

2010-08-06 Thread Mister IT Guru
On 06/08/10 15:21, Phil Stracchino wrote:
> On 08/06/10 05:27, Mister IT Guru wrote:
>
>> I would like to know if it is possible to get a windows box to shutdown
>> after it's finished a job?
>>  
> There is a fairly widely available shutdown.exe tool that can be run
> from a client-side after-backup script by the Director.
>
>
>
Thanks, I'll do a quick google search, and get going on that one.

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Shutdown Windows Box after backup? Howto?

2010-08-06 Thread Phil Stracchino
On 08/06/10 05:27, Mister IT Guru wrote:
> I would like to know if it is possible to get a windows box to shutdown 
> after it's finished a job?

There is a fairly widely available shutdown.exe tool that can be run
from a client-side after-backup script by the Director.


-- 
  Phil Stracchino, CDK#2 DoD#299792458 ICBM: 43.5607, -71.355
  ala...@caerllewys.net   ala...@metrocast.net   p...@co.ordinate.org
 Renaissance Man, Unix ronin, Perl hacker, Free Stater
 It's not the years, it's the mileage.

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Shutdown Windows Box after backup? Howto?

2010-08-06 Thread Thomas Mueller
Am Fri, 06 Aug 2010 10:27:21 +0100 schrieb Mister IT Guru:

> I would like to know if it is possible to get a windows box to shutdown
> after it's finished a job?
> 

script after backup?

http://www.bacula.org/5.0.x-manuals/en/main/main/Configuring_Director.html

keywords:
* RunScript
* Runs On Client
* Runs When



- Thomas


--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Shutdown

2007-06-04 Thread Arno Lehmann
Hi,

On 6/4/2007 2:37 PM, Adam Cécile wrote:
> Lucio Crusca a écrit :
>> I'd like configure Bacula so that it turns off the computer after the SD has 
>> finished writing the backup. I'm running Debian GNU/Linux and Bacula 2.0.3. 
>> Is there a way to do that?
>>
>>   
> RunAfterCmd ?

Definitely... I use the following in my office:

Job {
   Priority = 999
   Name = Shutdown
   Type = Admin
   Run Before Job = "/etc/bacula/shutdown.sh"
   Schedule = Shutdown
   Messages = Standard
   Storage = DLT
   Fileset = Alles
   Pool = Full
   Client = goblin-fd
   Max Start Delay = 20h
   Rerun Failed Levels = No
}

Note the high priority value.

bacula/[EMAIL PROTECTED] /root # cat /etc/bacula/shutdown.sh
#!/bin/bash

if [ -f /var/bacula/server/allowshutdown ] ; then
 echo "Shutdown will take place..."
 /var/bacula/server/sched_downtime goblin "`date -d "now + 5 min" \
"+%Y-%m-%d %H:%M:%S"`" "`date "-d tomorrow 8:12"`" 1 0 0 bacula \
"goblin turns off until tomorrow morning..."
 /sbin/shutdown -h -t 120 +6 &
else
 echo "Shutdown will not happen (/var/bacula/server/allowshutdown 
not present)"
fi
exit 0

Most of the stuff in the script is for Nagios integration and you can 
safely ignore it... so your "Run Before Job" line could also simply be 
"/sbin/shutdown -h -t 120 +6 &" (I'm unsure about the & for background 
execution - at least it's better to have the shutdown in the background 
so Bacula can correctly finish the job and won't have a running job left 
in the catalog.)

Arno


Arno
-- 
IT-Service Lehmann[EMAIL PROTECTED]
Arno Lehmann  http://www.its-lehmann.de


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Shutdown

2007-06-04 Thread Adam Cécile
Lucio Crusca a écrit :
> I'd like configure Bacula so that it turns off the computer after the SD has 
> finished writing the backup. I'm running Debian GNU/Linux and Bacula 2.0.3. 
> Is there a way to do that?
>
>   
RunAfterCmd ?

-- 
Adam CECILELinbox / Free&ALter Soft
152 rue de Grigy   tél: +33 3 87 50 87 95
Technopôle Metz 2000   fax: +33 3 87 75 19 26   
57070 METZ - Francehttp://www.linbox.com


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users