]> git.sur5r.net Git - bacula/bacula/blob - bacula/examples/upgrade-win32-client.txt
- Fix overriding storage specification to be done
[bacula/bacula] / bacula / examples / upgrade-win32-client.txt
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
5
6 Hello,
7
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 - ----------------------------------------------------------------
12 #!/bin/bash
13 #
14 # Remote Win32 client upgrade script
15 # written by Michel Meyers (last update 02/02/04 16:10)
16 #
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.
20 #
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
26 # - Unmount C;
27 # - Startup the new Bacula service
28 #
29 # To upgrade a machine append the following at the bottom of this file:
30 #
31 # SERVERNAME=<hostname>
32 # USERNAME=<username>
33 # PASSWORD=<password, "" for blank>
34 # upgrade
35
36 upgrade() {
37 rpcclient -S $SERVERNAME -U $USERNAME%"$PASSWORD" -c "service stop bacula"
38 sleep 30
39 smbmount //$SERVERNAME/c$ /mnt -o username=$USERNAME,password="$PASSWORD"
40 cp /home/michel/winbacula/bin/* /mnt/bacula/bin
41 umount /mnt
42 rpcclient -S $SERVERNAME -U $USERNAME%"$PASSWORD" -c "service start bacula"
43 }
44
45 SERVERNAME=xerxes
46 USERNAME=administrator
47 PASSWORD=secret
48 upgrade
49
50 SERVERNAME=shodan
51 USERNAME=teh_one
52 PASSWORD=""
53 upgrade
54 - ----------------------------------------------------------------
55
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, ...)
63
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).
66
67 Enjoy!
68