Re: [Bacula-users] shutdown windows client after backup
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 client after backup
On Thu, 26 May 2011 09:23:22 +0200 Marcello Romani mrom...@ottotecnica.com 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
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
Il 26/05/2011 11:00, Konstantin Khomoutov ha scritto: On Thu, 26 May 2011 09:23:22 +0200 Marcello Romanimrom...@ottotecnica.com 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
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