summarylogtreecommitdiffstats
path: root/MSUWebService
blob: bb4e7645bd82e4329bc82ca18599e33976cef658 (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
#!/usr/bin/bash
# Marvell Storage Utility Web Service.

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 Utility Web Service."
    /opt/marvell/storage/apache2/bin/apachectl start
    RETVAL=$?
}

stop()
{
    echo "Stopping Marvell Storage Utility Web Service."
    /opt/marvell/storage/apache2/bin/apachectl stop
    RETVAL=$?
}

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

exit $RETVAL