summaryrefslogtreecommitdiffstats
path: root/helper_scrips/start_glusterd.sh
blob: 5bc0901cec35004cef80bfa6e6f330a7b9dedd75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash

function _init ()
{
    set -u;
}

function start_glusterd ()
{
    local remote_server=;

    if [ $# -eq 1 ]; then
        remote_server=$1;
    fi

    if [ $remote_server ]; then
        ssh $remote_server glusterd;
        return 0;
    fi

    for i in $(cat /root/servers)
    do
      start_glusterd $i;
    done

}

function start_my_glusterd ()
{
    glusterd;
    return $?;
}

function main ()
{
    stat --printf=%i /root/servers 2>/dev/null 1>/dev/null;
    if [ $? -ne 0 ]; then
        echo "servers file is not present /root. Cannot execute further."
        exit 1
    fi

    start_glusterd;
    start_my_glusterd;

    return 0;
}

_init && main "$@"