Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37778530
en ru br
ALT Linux repos
S:4.2-alt3
5.0: 2.6.3-alt1
4.1: 2.6.3-alt1
4.0: 2.6.1-alt3.1
3.0: 1.12.0-alt2

Group :: System/Configuration/Hardware
RPM: mdadm

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

#!/bin/bash
#
# mdadm This starts, stops, and reloads the mdadm-based
# software RAID monitoring and management facility
#
# chkconfig: 2345 15 85
# description: software RAID monitoring and management
# processname: mdadm
# config: /etc/mdadm.conf
# pidfile: /var/run/mdadm.pid
#

# Copyright 2002 Red Hat, Inc.
# Changed 2005 for ALTLinux

# Source function library.
WITHOUT_RC_COMPAT=1
. /etc/init.d/functions

prog=mdadm
PIDFILE=/var/run/$prog.pid
LOCKFILE=/var/lock/subsys/$prog
CONFFILE=/etc/$prog.conf
EXPECTUSER=root
RETVAL=0

# Make sure configuration file exists and has information we can use
# MAILADDR or PROGRAM or both must be set in order to run mdadm --monitor
[ -f "$CONFFILE" ] || exit 0
grep '^\(MAILADDR\|PROGRAM\) .' "$CONFFILE" >/dev/null 2>&1 || exit 0

do_call() {
local fn=$1
shift
$fn --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user "$EXPECTUSER" -- $prog "$@"
RETVAL=$?
return $RETVAL
}

need_start() {
grep -iwqs noraidtab /proc/cmdline && return 1
test -f /proc/mdstat || return 1
grep -qs '^md[0-9 ]\+:' /proc/mdstat || return 1
return 0
}

do_stop() {
test -x "${1}/$prog" || return
PATH="${1}:$PATH" do_call stop_daemon
}

case "$1" in
forcestart) do_call start_daemon --monitor --scan --daemonise --pid-file=$PIDFILE ;;
start) need_start && $0 forcestart ;;
stop) do_stop /sbin; do_stop /usr/sbin ;;
status) do_call status ;;
restart|reload) $0 stop; $0 start ;;
condstop) [ -e "$LOCKFILE" ] && $0 stop ;;
condrestart|condreload) [ -e "$LOCKFILE" ] && $0 restart ;;
*) msg_usage "${0##*/} {start|stop|status|restart|condrestart|condstop}"
RETVAL=1
;;
esac

exit $RETVAL

## EOF ##
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin