summarylogtreecommitdiffstats
path: root/MSUAgent
blob: c5076cf85e20c22fcc6dc3ab20b72d245746c561 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/bash
# Marvell Storage Utility Raid Event Agent.

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

RETVAL=1

LD_LIBRARY_PATH=/opt/marvell/storage/apache2/lib64
LD_LIBRARY_PATH=$LD_LIBRARYPATH:/opt/marvell/storage/expat/lib64
LD_LIBRARY_PATH=$LD_LIBRARYPATH:/opt/marvell/storage/libxml2/lib64
LD_LIBRARY_PATH=$LD_LIBRARYPATH:/opt/marvell/storage/openssl/lib64
LD_LIBRARY_PATH=$LD_LIBRARYPATH:/opt/marvell/storage/php/lib64

export LD_LIBRARY_PATH

start()
{
    if lsmod | grep -Eq "^sg " &> /dev/null
    then
        echo "SCSI kernel module 'sg' is loaded."
    else
        echo "SCSI kernel module 'sg' is not loaded."
        echo "Trying to load 'sg'."
        if [[ $(modprobe -a sg) -ne 0 ]]
        then
            echo "Could not load kernel module 'sg'."
            exit 1
        fi
    fi
    echo "Starting Marvell Storage Event Agent."
    /opt/marvell/storage/apache2/bin/mvraidsvc start
    RETVAL=$?
}

stop()
{
    echo "Stopping Marvell Storage Event Agent."
    /opt/marvell/storage/apache2/bin/mvraidsvc stop
    RETVAL=$?
    if [ -e /tmp/WDKMS.PID ]
    then
        rm -fr /tmp/WDKMS.PID
    fi
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
esac

exit $RETVAL