View | Details | Raw Unified | Return to bug 16885
Collapse All | Expand All

(-)a/debian/scripts/koha-stop-zebra (-3 / +29 lines)
Lines 31-45 stop_zebra_instance() Link Here
31
    local instancename=$1
31
    local instancename=$1
32
32
33
    echo "Stopping Zebra server for $instancename"
33
    echo "Stopping Zebra server for $instancename"
34
35
    # both daemon and zebrasrv processes for one instance
36
    # will go away, but there could be other processes
37
    # for other instances.
38
    expecting=`ps aux | grep zebra | wc -l`
39
    expecting=$((expecting-2))
40
41
    # Issue command to stop the zebra server
34
    daemon \
42
    daemon \
35
        --name="$instancename-koha-zebra" \
43
        --name="$instancename-koha-zebra" \
36
        --pidfiles="/var/run/koha/$instancename/" \
44
        --pidfiles="/var/run/koha/$instancename/" \
37
        --user="$instancename-koha.$instancename-koha" \
45
        --user="$instancename-koha.$instancename-koha" \
38
        --stop \
46
        --stop \
39
        -- \
47
        -- \
40
        zebrasrv \
48
        zebrasrv
41
        return 0 || \
49
50
    # If it doesn't return nicely, return 1 for bad.
51
    if [ $? -ne 0 ]; then
42
        return 1
52
        return 1
53
    fi
54
55
    # Now actually wait a bit. But not forever.
56
    count=0
57
    check=$((expecting+2))
58
    while ( [ $count -lt 10 ] && [ $check -gt $expecting ] ); do
59
        count=$((count+1))
60
        # Recount the zebra related processes
61
        check=`ps aux | grep zebra | wc -l`
62
    done
63
64
    # return 1 for 10 loops of not stopped yet.
65
    if [ $check -ne $expecting ]; then
66
        return 1
67
    else
68
        return 0
69
    fi
43
}
70
}
44
71
45
usage()
72
usage()
46
- 

Return to bug 16885