diff options
author | Dominik Schrempf | 2017-09-05 16:59:09 +0200 |
---|---|---|
committer | Dominik Schrempf | 2017-09-05 16:59:09 +0200 |
commit | 05e344be6cdeb491958197f04bbdc2e05a2507c1 (patch) | |
tree | 204033e79b5b107cf72326a6b6d2f41f0a9daf7b /MSUAgent | |
download | aur-05e344be6cdeb491958197f04bbdc2e05a2507c1.tar.gz |
First commit.
- Script have been amended for Arch Linux.
- Systemd services have to be provided.
Diffstat (limited to 'MSUAgent')
-rwxr-xr-x | MSUAgent | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/MSUAgent b/MSUAgent new file mode 100755 index 000000000000..c5076cf85e20 --- /dev/null +++ b/MSUAgent @@ -0,0 +1,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 |