]> git.ipfire.org Git - thirdparty/mdadm.git/blame - misc/syslog-events
sysfs: Avoid if and return on the same line
[thirdparty/mdadm.git] / misc / syslog-events
CommitLineData
b5e64645
NB
1#!/bin/sh
2#
3# sample event handling script for mdadm
4# e.g. mdadm --follow --program=/sbin/syslog-events --scan
5#
6# License: GPL ver.2
7# Copyright (C) 2004 SEKINE Tatsuo <tsekine@sdri.co.jp>
8
9event="$1"
10dev="$2"
11disc="$3"
12
13facility="kern"
14tag="mdmonitor"
15
16case x"${event}" in
17 xFail*) priority="error" ;;
18 xTest*) priority="debug" ;;
19 x*) priority="info" ;;
20esac
21
22msg="${event} event on ${dev}"
23if [ x"${disc}" != x ]; then
24 msg="${msg}, related to disc ${disc}"
25fi
26
27exec logger -t "${tag}" -p "${facility}.${priority}" -- "${msg}"