Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 - 1
#! /bin/sh
2
 
3
# smartmontools init file for smartd
4
# Copyright (C) 2002-4 Bruce Allen <smartmontools-support@lists.sourceforge.net>
5
# $Id: smartd.initd,v 1.2 2004/09/17 11:55:28 arjanv Exp $
6
 
7
# For RedHat and cousins:
8
# chkconfig: - 99 01
9
# description: Self Monitoring and Reporting Technology (SMART) Daemon
10
# processname: smartd
11
 
12
### BEGIN INIT INFO
13
# Provides: smartd
14
# Required-Start: $local_fs $network
15
# Required-Stop: $local_fs $network
16
# Should-Start:
17
# Default-Start:
18
# Default-Stop: 0 1 2 3 4 5 6
19
# Short-Description: Self Monitoring and Reporting Technology (SMART) Daemon
20
# Description: The smartd daemon monitors SMART status of the local hard drives and
21
#   provides advanced warnings of of disk degradation or failures.
22
### END INIT INFO
23
 
24
# This program is free software; you can redistribute it and/or modify it
25
# under the terms of the GNU General Public License as published by the Free
26
# Software Foundation; either version 2, or (at your option) any later
27
# version.
28
# You should have received a copy of the GNU General Public License (for
29
# example COPYING); if not, write to the Free Software Foundation, Inc., 675
30
# Mass Ave, Cambridge, MA 02139, USA.
31
# This code was originally developed as a Senior Thesis by Michael Cornwell
32
# at the Concurrent Systems Laboratory (now part of the Storage Systems
33
# Research Center), Jack Baskin School of Engineering, University of
34
# California, Santa Cruz. http://ssrc.soe.ucsc.edu/.
35
 
36
# Uncomment the line below to pass options to smartd on startup.
37
# Note that distribution specific configuration files like
38
# /etc/{default,sysconfig}/smartmontools might override these
39
#smartd_opts="--interval=1800"
40
 
41
SMARTD_BIN=/usr/sbin/smartd
42
 
43
# Source function library
44
. /etc/rc.d/init.d/functions
45
 
46
[ -r /etc/sysconfig/smartmontools ] && . /etc/sysconfig/smartmontools
47
 
48
RETVAL=0
49
prog=smartd
50
pidfile=/var/lock/subsys/smartd
51
config=/etc/smartd.conf
52
 
53
start()
54
{
55
        [ $UID -eq 0 ] || exit 4
56
        [ -x $SMARTD_BIN ] || exit 5
57
        [ -f $config ] || exit 6
58
	echo -n $"Starting $prog: "
59
	daemon $SMARTD_BIN $smartd_opts
60
	RETVAL=$?
61
	echo
62
	[ $RETVAL = 0 ] && touch $pidfile
63
	return $RETVAL
64
}
65
 
66
stop()
67
{
68
        [ $UID -eq 0 ] || exit 4
69
	echo -n $"Shutting down $prog: "
70
	killproc $SMARTD_BIN
71
	RETVAL=$?
72
	echo
73
	rm -f $pidfile
74
	return $RETVAL
75
}
76
 
77
reload()
78
{
79
	echo -n $"Reloading $prog daemon configuration: "
80
	killproc $SMARTD_BIN -HUP
81
	RETVAL=$?
82
	echo
83
	return $RETVAL
84
}
85
 
86
report()
87
{
88
	echo -n $"Checking SMART devices now: "
89
	killproc $SMARTD_BIN -USR1
90
	RETVAL=$?
91
	echo
92
	return $RETVAL
93
}
94
 
95
case "$1" in
96
	start)
97
		start
98
		;;
99
	stop)
100
		stop
101
		;;
102
	reload)
103
		reload
104
		;;
105
	report)
106
		report
107
		;;
108
	restart)
109
		stop
110
		start
111
		;;
112
	condrestart|try-restart)
113
		if [ -f $pidfile ]; then
114
			stop
115
			start
116
		fi
117
		;;
118
	force-reload)
119
		reload || (stop; start)
120
		;;
121
	status)
122
		status $prog
123
		RETVAL=$?
124
		;;
125
	*)
126
		echo $"Usage: $0 {start|stop|restart|status|condrestart|try-restart|reload|force-reload|report}"
127
		RETVAL=2
128
		[ "$1" = 'usage' ] && RETVAL=0
129
esac
130
 
131
exit $RETVAL
132