1#!/bin/bash
2#
3# Setup windows box
4#
5. scripts/functions
6
7echo "Trying to setup $WIN32_ADDR"
8URL=http://$WIN32_ADDR:8091
9
10echo "Stopping bareos-fd service"
11wget -qO /dev/null "$URL/stop"
12
13echo -en "Set director name:\t\t"
14wget -qO - "$URL/set_director_name?name=$HOST-dir;pass=$WIN32_PASSWORD"
15
16if [ x$WIN32_USER != x ]; then
17    echo -en "Setting auto_logon:\t\t"
18    wget -qO - "$URL/set_auto_logon?user=$WIN32_USER;pass=$WIN32_PASS"
19fi
20
21update_win32
22
23echo "Starting bareos-fd service"
24wget -qO /dev/null "$URL/start"
25
26echo -ne "Reloading regress-win32.pl:\t"
27wget -qO - "$URL/reload"
28
29i=0
30while ! wget -qO /dev/null $URL/nop; do
31    sleep 5
32    i=`expr $i + 1`
33    if [ $i -ge 12 ]; then  # print message every minute
34       i=0
35       echo "== `date +%T` Waiting for script to reload"
36    fi
37done
38