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