From: "Michel Meyers" To: "bacula-users" Subject: [Bacula-users] Script for pushing new clients to Windows boxes Date: Mon, 2 Feb 2004 16:10:48 +0100 Hello, Some of you may remember my document on how to remotely push a Win32 bacula client onto a WinNT/2k/XP box. Well, I've written a script to do it for me and thought I'd share it with you: - ---------------------------------------------------------------- #!/bin/bash # # Remote Win32 client upgrade script # written by Michel Meyers (last update 2006-09-25 11:34) # # WARNING: Make sure that no bacula-fd.conf exists in the source directory! # You will destroy/overwrite all your client's configs if you don't # be careful with this. # # The upgrade function does the following: # - Shutdown Bacula service on remote machine # - Wait 30 seconds (to allow proper shutdown) # - Mount C: drive of remote box # - Copy new client to remote machine # - Unmount C; # - Startup the new Bacula service # # To upgrade a machine append the following at the bottom of this file: # # SERVERNAME= # USERNAME= # PASSWORD= # upgrade upgrade() { net rpc -S $SERVERNAME -U $USERNAME%"$PASSWORD" service stop bacula sleep 30 smbmount //$SERVERNAME/c$ /mnt -o username=$USERNAME,password="$PASSWORD" cp /home/michel/winbacula/bin/* /mnt/bacula/bin umount /mnt net rpc -S $SERVERNAME -U $USERNAME%"$PASSWORD" service start bacula } SERVERNAME=xerxes USERNAME=administrator PASSWORD=secret upgrade SERVERNAME=shodan USERNAME=teh_one PASSWORD="" upgrade - ---------------------------------------------------------------- It should be pretty self-explanatory. I'm not good at shell programming and I don't know whether there's any notion of arrays or 'for' loops that could make it cleaner so I simply wrote a function which references some variables and then call that repeatedly (once per machine). You can of course change the values according to your system and liking (if 30 secs seem to much for you, just reduce the value after sleep, make sure to check on the paths and mountpoint /mnt may not be usable on your system, ...) Note: The requirements are the same as described in my other document (Samba-TNG clients among others, otherwise you'll be missing rpcclient). Update 2006-09-25: Samba-TNG is no longer required, the 'net' command from Samba 3 works for starting and stopping services. Paths may need to be updated with quotation marks as the new Bacula Win32 Installer no longer installs into C:\bacula but into 'C:\Program Files\bacula' (on English Windows versions). Enjoy!