]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - smartd.initd.in
Enhance dh_clean to clean up better
[mirror_smartmontools-debian.git] / smartd.initd.in
CommitLineData
832b75ed
GG
1#! /bin/sh
2
3# smartmontools init file for smartd
34ad0c5f 4# Copyright (C) 2002-8 Bruce Allen <smartmontools-support@lists.sourceforge.net>
ee38a438 5# $Id: smartd.initd.in 3727 2012-12-13 17:23:06Z samm2 $
832b75ed
GG
6
7# For RedHat and cousins:
8# chkconfig: 2345 40 40
9# description: Self Monitoring and Reporting Technology (SMART) Daemon
10# processname: smartd
11
12# For SuSE and cousins
13### BEGIN INIT INFO
34ad0c5f 14# Provides: smartd
a7e8ffec
GI
15# Required-Start: $syslog $remote_fs
16# Should-Start: sendmail
17# Required-Stop: $syslog $remote_fs
18# Should-Stop: sendmail
34ad0c5f 19# Default-Start: 2 3 5
832b75ed 20# Default-Stop:
34ad0c5f
GG
21# Short-Description: Monitors disk and tape health via S.M.A.R.T.
22# Description: Start S.M.A.R.T. disk and tape monitor.
832b75ed
GG
23### END INIT INFO
24
25# This program is free software; you can redistribute it and/or modify it
26# under the terms of the GNU General Public License as published by the Free
27# Software Foundation; either version 2, or (at your option) any later
28# version.
29# You should have received a copy of the GNU General Public License (for
ee38a438
GI
30# example COPYING); if not, write to the Free Software Foundation, Inc.,
31# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
832b75ed
GG
32# This code was originally developed as a Senior Thesis by Michael Cornwell
33# at the Concurrent Systems Laboratory (now part of the Storage Systems
34# Research Center), Jack Baskin School of Engineering, University of
35# California, Santa Cruz. http://ssrc.soe.ucsc.edu/.
36
37# Uncomment the line below to pass options to smartd on startup.
38# Note that distribution specific configuration files like
39# /etc/{default,sysconfig}/smartmontools might override these
40#smartd_opts="--interval=1800"
41
42SMARTD_BIN=/usr/local/sbin/smartd
43
44report_unsupported () {
45 echo "Currently the smartmontools package has no init script for"
46 echo "the $1 OS/distribution. If you can provide one or this"
47 echo "one works after removing some ifdefs, please contact"
48 echo "smartmontools-support@lists.sourceforge.net."
49 exit 1
50}
51
52# Red Hat or Yellow Dog or Mandrake
53if [ -f /etc/redhat-release -o -f /etc/yellowdog-release -o -f /etc/mandrake-release -o -f /etc/whitebox-release -o -f /etc/trustix-release -o -f /etc/tinysofa-release ] ; then
a7e8ffec
GI
54
55 # Source function library
832b75ed
GG
56 . /etc/rc.d/init.d/functions
57
a7e8ffec 58 # Source configuration file. This should define the shell variable smartd_opts
832b75ed 59 [ -r /etc/sysconfig/smartmontools ] && . /etc/sysconfig/smartmontools
a7e8ffec 60
832b75ed 61 RETVAL=0
a7e8ffec 62
832b75ed 63 prog=smartd
a7e8ffec
GI
64 pidfile=/var/lock/subsys/smartd
65 config=/etc/smartd.conf
66
67 start()
68 {
69 [ $UID -eq 0 ] || exit 4
70 [ -x $SMARTD_BIN ] || exit 5
71 [ -f $config ] || exit 6
72 echo -n $"Starting $prog: "
73 daemon $SMARTD_BIN $smartd_opts
74 RETVAL=$?
75 echo
76 [ $RETVAL = 0 ] && touch $pidfile
77 return $RETVAL
78 }
79
80 stop()
81 {
82 [ $UID -eq 0 ] || exit 4
83 echo -n $"Shutting down $prog: "
84 killproc $SMARTD_BIN
85 RETVAL=$?
86 echo
87 rm -f $pidfile
88 return $RETVAL
89 }
90
91 reload()
92 {
93 echo -n $"Reloading $prog daemon configuration: "
94 killproc $SMARTD_BIN -HUP
95 RETVAL=$?
96 echo
97 return $RETVAL
98 }
99
100 report()
101 {
102 echo -n $"Checking SMART devices now: "
103 killproc $SMARTD_BIN -USR1
104 RETVAL=$?
105 echo
106 return $RETVAL
107 }
108
832b75ed
GG
109 case "$1" in
110 start)
a7e8ffec
GI
111 start
112 ;;
832b75ed 113 stop)
a7e8ffec
GI
114 stop
115 ;;
832b75ed 116 reload)
a7e8ffec
GI
117 reload
118 ;;
832b75ed 119 report)
a7e8ffec
GI
120 report
121 ;;
832b75ed 122 restart)
a7e8ffec
GI
123 stop
124 start
125 ;;
126 condrestart|try-restart)
127 if [ -f $pidfile ]; then
128 stop
129 start
130 fi
131 ;;
132 force-reload)
133 reload || (stop; start)
134 ;;
832b75ed 135 status)
a7e8ffec
GI
136 status $prog
137 RETVAL=$?
138 ;;
832b75ed 139 *)
a7e8ffec
GI
140 echo $"Usage: $0 {start|stop|restart|status|condrestart|try-restart|reload|force-reload|report}"
141 RETVAL=2
142 [ "$1" = 'usage' ] && RETVAL=0
832b75ed 143 esac
832b75ed
GG
144 exit $RETVAL
145
146# Slackware
147elif [ -f /etc/slackware-version ] ; then
a7e8ffec
GI
148
149 # Source configuration file. This should define the shell variable smartd_opts.
150 # Email smartmontools-support@lists.sourceforge.net if there is a better choice
151 # of path for Slackware.
832b75ed
GG
152
153 [ -r /etc/sysconfig/smartmontools ] && . /etc/sysconfig/smartmontools
154
a7e8ffec 155 RETVAL=0
832b75ed
GG
156 case "$1" in
157 start)
158 echo -n "Starting smartd: "
159 $SMARTD_BIN $smartd_opts
a7e8ffec 160 RETVAL=$?
832b75ed
GG
161 echo
162 ;;
163 stop)
164 echo -n "Shutting down smartd: "
165 killall $SMARTD_BIN
a7e8ffec 166 RETVAL=$?
832b75ed
GG
167 echo
168 ;;
169 restart)
170 $0 stop
171 sleep 1
172 $0 start
a7e8ffec
GI
173 RETVAL=$?
174 ;;
175 try-restart)
176 if pidof $SMARTD_BIN >/dev/null; then
177 $0 restart
178 RETVAL=$?
179 fi
180 ;;
181 force-reload)
182 $0 reload || $0 restart
183 RETVAL=$?
184 ;;
185 reload)
186 echo -n "Reloading smartd configuration: "
187 killall -s HUP $SMARTD_BIN
188 RETVAL=$?
189 echo
190 ;;
191 report)
192 echo -n "Checking SMART devices now: "
193 killall -s USR1 $SMARTD_BIN
194 RETVAL=$?
195 echo
196 ;;
197 status)
198 if pidof $SMARTD_BIN >/dev/null; then
199 echo "$SMARTD_BIN is running."
200 else
201 echo "$SMARTD_BIN is not running."
202 RETVAL=1
203 fi
832b75ed
GG
204 ;;
205 *)
a7e8ffec
GI
206 echo "Usage: $0 {start|stop|restart|try-restart|force-reload|reload|report|status}"
207 RETVAL=1
832b75ed 208 esac
a7e8ffec
GI
209 exit $RETVAL
210
832b75ed
GG
211# SuSE
212elif [ -f /etc/SuSE-release ] ; then
213 test -x $SMARTD_BIN || exit 5
a7e8ffec 214
832b75ed
GG
215 # Existence of config file is optional
216 SMARTD_CONFIG=/etc/smartd.conf
217
a7e8ffec
GI
218 # source configuration file.
219 [ -r /etc/sysconfig/smartmontools ] && . /etc/sysconfig/smartmontools
220 smartd_opts=
221 if test -n "$SMARTD_CHECK_INTERVAL" -a "$SMARTD_CHECK_INTERVAL" != 1800 ; then
222 smartd_opts=" -i $SMARTD_CHECK_INTERVAL"
223 fi
224 if test -n "$SMARTD_LOG_FACILITY" -a "$SMARTD_LOG_FACILITY" != "daemon" ; then
225 smartd_opts="$smartd_opts -l $SMARTD_LOG_FACILITY"
226 fi
227 if test -n "$SMARTD_DRIVEDB" ; then
228 smartd_opts="$smartd_opts -B $SMARTD_DRIVEDB"
229 fi
ee38a438
GI
230 if test "$SMARTD_SAVESTATES" = "no" ; then
231 smartd_opts="$smartd_opts -s \"\""
232 fi
233 if test "$SMARTD_ATTRLOG" = "no" ; then
234 smartd_opts="$smartd_opts -A \"\""
235 fi
236 if test -n "$SMARTD_EXTRA_OPTS" ; then
237 smartd_opts="$smartd_opts $SMARTD_EXTRA_OPTS"
238 fi
832b75ed 239
a7e8ffec
GI
240 # Shell functions sourced from /etc/rc.status:
241 # rc_check check and set local and overall rc status
242 # rc_status check and set local and overall rc status
243 # rc_status -v be verbose in local rc status and clear it afterwards
244 # rc_status -v -r ditto and clear both the local and overall rc status
245 # rc_status -s display "skipped" and exit with status 3
246 # rc_status -u display "unused" and exit with status 3
247 # rc_failed set local and overall rc status to failed
248 # rc_failed <num> set local and overall rc status to <num>
249 # rc_reset clear both the local and overall rc status
250 # rc_exit exit appropriate to overall rc status
251 # rc_active checks whether a service is activated by symlinks
832b75ed 252 . /etc/rc.status
a7e8ffec
GI
253
254 # Reset status of this service
832b75ed 255 rc_reset
a7e8ffec
GI
256
257 # Return values acc. to LSB for all commands but status:
258 # 0 - success
259 # 1 - generic or unspecified error
260 # 2 - invalid or excess argument(s)
261 # 3 - unimplemented feature (e.g. "reload")
262 # 4 - user had insufficient privileges
263 # 5 - program is not installed
264 # 6 - program is not configured
265 # 7 - program is not running
266 # 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
267 #
268 # Note that starting an already running service, stopping
269 # or restarting a not-running service as well as the restart
270 # with force-reload (in case signaling is not supported) are
271 # considered a success.
272
832b75ed
GG
273 case "$1" in
274 start)
ba59cff1 275 echo -n "Starting smartd "
a7e8ffec
GI
276 ## Start daemon with startproc(8). If this fails
277 ## the return value is set appropriately by startproc.
278
279 # We don't use startproc - we need to check for return code 17.
280 if ! /sbin/checkproc $SMARTD_BIN ; then
ee38a438 281 eval $SMARTD_BIN$smartd_opts
a7e8ffec
GI
282 # Remember status and be verbose
283 if test $? -ne 17 ; then
284 rc_status -v
285 else
286 rc_status -u
287 fi
288 else
289 rc_reset
290 rc_status -v
291 fi
832b75ed
GG
292 ;;
293 stop)
ba59cff1 294 echo -n "Shutting down smartd "
a7e8ffec
GI
295 /sbin/killproc -TERM $SMARTD_BIN
296 # Remember status and be verbose
297 rc_status -v
832b75ed 298 ;;
a7e8ffec 299 try-restart)
ba59cff1
GG
300 ## Do a restart only if the service was active before.
301 ## Note: try-restart is now part of LSB (as of 1.9).
ba59cff1
GG
302 $0 status
303 if test $? = 0; then
a7e8ffec
GI
304 $0 restart
305 else
306 rc_reset # Not running is not a failure.
ba59cff1
GG
307 fi
308 # Remember status and be quiet
309 rc_status
310 ;;
a7e8ffec 311 restart)
832b75ed
GG
312 $0 stop
313 $0 start
a7e8ffec
GI
314 # Remember status and be quiet
315 rc_status
832b75ed 316 ;;
a7e8ffec
GI
317 force-reload|reload)
318 echo -n "Reload service smartd "
319 /sbin/killproc -HUP $SMARTD_BIN
832b75ed
GG
320 rc_status -v
321 ;;
a7e8ffec
GI
322 report)
323 ## Checking SMART devices now (smartd specific function)
324 echo -n "Checking SMART devices now "
325 /sbin/killproc -USR1 $SMARTD_BIN
326 rc_status -v
327 ;;
328 status)
329 echo -n "Checking for service smartd "
330 ## Check status with checkproc(8), if process is running
331 ## checkproc will return with exit status 0.
332
333 # Return value is slightly different for the status command:
334 # 0 - service up and running
335 # 1 - service dead, but /var/run/ pid file exists
336 # 2 - service dead, but /var/lock/ lock file exists
337 # 3 - service not running (unused)
338 # 4 - service status unknown :-(
339 # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
340
341 # NOTE: checkproc returns LSB compliant status values.
342 /sbin/checkproc $SMARTD_BIN
343 rc_status -v
344 ;;
345 probe)
832b75ed
GG
346 ## Optional: Probe for the necessity of a reload, print out the
347 ## argument to this init script which is required for a reload.
a7e8ffec 348 ## Note: probe is not (yet) part of LSB (as of 1.9)
832b75ed
GG
349
350 test $SMARTD_CONFIG -nt /var/run/smartd.pid && echo reload
351 ;;
352 *)
a7e8ffec 353 echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|report|probe}"
832b75ed 354 exit 1
832b75ed 355 esac
832b75ed
GG
356 rc_exit
357
358# Debian case
359elif [ -f /etc/debian_version ] ; then
a7e8ffec
GI
360 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
361 SMARTDPID=/var/run/smartd.pid
362 [ -x $SMARTD_BIN ] || exit 0
363 RET=0
364
365 # source configuration file
366 [ -r /etc/default/rcS ] && . /etc/default/rcS
367 [ -r /etc/default/smartmontools ] && . /etc/default/smartmontools
832b75ed 368
a7e8ffec 369 smartd_opts="--pidfile $SMARTDPID $smartd_opts"
832b75ed 370
a7e8ffec 371 case "$1" in
832b75ed
GG
372 start)
373 echo -n "Starting S.M.A.R.T. daemon: smartd"
374 if start-stop-daemon --start --quiet --pidfile $SMARTDPID \
a7e8ffec
GI
375 --exec $SMARTD_BIN -- $smartd_opts; then
376 echo "."
832b75ed 377 else
a7e8ffec 378 echo " (failed)"
832b75ed 379 RET=1
a7e8ffec
GI
380 fi
381 ;;
832b75ed
GG
382 stop)
383 echo -n "Stopping S.M.A.R.T. daemon: smartd"
384 start-stop-daemon --stop --quiet --oknodo --pidfile $SMARTDPID
385 echo "."
a7e8ffec
GI
386 ;;
387 restart)
388 $0 stop
389 $0 start
390 ;;
391 force-reload)
392 $0 reload || $0 restart
393 ;;
394 reload)
395 echo -n "Reload S.M.A.R.T. daemon: smartd"
396 if start-stop-daemon --stop --quiet --signal 1 \
397 --pidfile $SMARTDPID; then
398 echo "."
399 else
400 echo " (failed)"
401 RET=1
402 fi
403 ;;
404 report)
405 echo -n "Checking SMART devices now"
406 if start-stop-daemon --stop --quiet --signal 10 \
407 --pidfile $SMARTDPID; then
408 echo "."
409 else
410 echo " (failed)"
411 RET=1
412 fi
413 ;;
414 status)
415 if pidof $SMARTD_BIN >/dev/null; then
416 echo "$SMARTD_BIN is running."
417 else
418 echo "$SMARTD_BIN is not running."
419 RET=1
420 fi
421 ;;
422 *)
423 echo "Usage: $0 {start|stop|restart|force-reload|reload|report|status}"
832b75ed 424 exit 1
a7e8ffec
GI
425 esac
426 exit $RET
832b75ed
GG
427
428elif [ -f /etc/gentoo-release ] ; then
429 report_unsupported "Gentoo"
430
431elif [ -f /etc/turbolinux-release ] ; then
432 report_unsupported "Turbolinux"
433
434elif [ -f /etc/environment.corel ] ; then
435 report_unsupported "Corel"
436
437# PLEASE ADD OTHER LINUX DISTRIBUTIONS JUST BEFORE THIS LINE, USING elif
438
439elif uname -a | grep FreeBSD > /dev/null 2>&1 ; then
a7e8ffec 440 # following is replaced by port install
832b75ed 441 PREFIX=@@PREFIX@@
832b75ed 442
a7e8ffec
GI
443 # Updated to try both the RCNG version of things from 5.x, or fallback to
444 # oldfashioned rc.conf
445
446 if [ -r /etc/rc.subr ]; then
447 # This is RC-NG, pick up our values
832b75ed 448 . /etc/rc.subr
a7e8ffec
GI
449 name="smartd"
450 rcvar="smartd_enable"
451 command="$SMARTD_BIN"
832b75ed
GG
452 load_rc_config $name
453 elif [ -r /etc/defaults/rc.conf ]; then
a7e8ffec 454 # Not a 5.x system, try the default location for variables
832b75ed
GG
455 . /etc/defaults/rc.conf
456 source_rc_confs
457 elif [ -r /etc/rc.conf ]; then
a7e8ffec 458 # Worst case, fallback to system config file
832b75ed
GG
459 . /etc/rc.conf
460 fi
461
a7e8ffec
GI
462 if [ -r /etc/rc.subr ]; then
463 # Use new functionality from RC-NG
832b75ed
GG
464 run_rc_command "$1"
465 else
466 PID_FILE=/var/run/smartd.pid
467 case "$1" in
468 start)
469 $SMARTD_BIN -p $PID_FILE $smartd_flags
470 echo -n " smartd"
471 ;;
472 stop)
473 kill `cat $PID_FILE`
474 echo -n " smartd"
475 ;;
476 restart)
477 $0 stop
478 sleep 1
479 $0 start
480 ;;
a7e8ffec
GI
481 reload)
482 kill -s HUP `cat $PID_FILE`
483 ;;
484 report)
485 kill -s USR1 `cat $PID_FILE`
486 ;;
832b75ed 487 *)
a7e8ffec 488 echo "Usage: $0 {start|stop|restart|reload|report}"
832b75ed
GG
489 exit 1
490 esac
832b75ed
GG
491 exit 0
492 fi
a7e8ffec 493
832b75ed 494elif uname -a | grep SunOS > /dev/null 2>&1 ; then
a7e8ffec
GI
495
496 # Source configuration file. This should define the shell variable smartd_opts.
497 # Email smartmontools-support@lists.sourceforge.net if there is a better choice
498 # of path for Solaris
832b75ed
GG
499
500 [ -r /etc/default/smartmontools ] && . /etc/default/smartmontools
501
502 PID_FILE=/var/run/smartd.pid
a7e8ffec 503
832b75ed
GG
504 case "$1" in
505 start)
506 $SMARTD_BIN -p $PID_FILE $smartd_opts
507 echo -n "smartd "
508 ;;
509 stop)
510 [ -f $PID_FILE ] && kill `cat $PID_FILE`
511 echo -n "smartd "
512 ;;
513 restart)
514 $0 stop
515 sleep 1
516 $0 start
517 ;;
a7e8ffec
GI
518 reload)
519 kill -s HUP `cat $PID_FILE`
520 ;;
521 report)
522 kill -s USR1 `cat $PID_FILE`
523 ;;
832b75ed 524 *)
a7e8ffec 525 echo "Usage: $0 {start|stop|restart|reload|report}"
832b75ed
GG
526 exit 1
527 esac
832b75ed
GG
528 exit 0
529
530# Cygwin
531elif uname | grep -i CYGWIN > /dev/null 2>&1 ; then
532
a7e8ffec 533 # The following settings may be changed by the configuration file below
832b75ed
GG
534 # Service Name (must be unique)
535 smartd_svcname=smartd
536 # Service display name
537 smartd_svcdisp="CYGWIN smartd"
538 # Service description
539 smartd_svcdesc="\
540Controls and monitors storage devices using the Self-Monitoring \
541Analysis and Reporting Technology System (S.M.A.R.T.) \
542built into ATA and SCSI Hard Drives. \
543http://smartmontools.sourceforge.net/"
544
a7e8ffec
GI
545 # Source configuration file. This should define the shell variable smartd_opts.
546 # Email smartmontools-support@lists.sourceforge.net if there is a better choice
547 # of path for Cygwin
832b75ed
GG
548
549 [ -r /etc/sysconfig/smartmontools ] && . /etc/sysconfig/smartmontools
550
551 PID_FILE=/var/run/smartd.pid
552 RETVAL=0
553
554 # Note: "[ -r $PID_FILE ]" is not used here. On Cygwin, this command may
555 # return success even if the file is present but cannot be read by current user.
556 # If smartd is running as service, smartd.pid is owned by local system account
557 # which is different from any user ever executing this script.
558
559 case "$1" in
560 start)
561 if cygrunsrv -L 2>/dev/null | grep "^${smartd_svcname}$" >/dev/null 2>&1; then
562 echo -n "Starting service $smartd_svcname: "
563 cygrunsrv -S "$smartd_svcname"
564 else
565 echo -n "Starting smartd as daemon: "
566 $SMARTD_BIN -p $PID_FILE $smartd_opts
567 fi
568 RETVAL=$?
569 ;;
570 stop)
571 echo -n "Shutting down smartd: "
572 pid="`cat $PID_FILE 2>/dev/null`" && kill "$pid"
573 RETVAL=$?
574 ;;
575 reload)
576 echo -n "Reloading smartd configuration: "
577 pid="`cat $PID_FILE 2>/dev/null`" && kill -HUP "$pid"
578 RETVAL=$?
579 ;;
580 report)
581 echo -n "Checking SMART devices now: "
582 pid="`cat $PID_FILE 2>/dev/null`" && kill -USR1 "$pid"
583 RETVAL=$?
584 ;;
585 restart)
586 $0 stop
587 sleep 1
588 $0 start
589 exit $?
590 ;;
591 install)
592 shift
593 [ $# -eq 0 ] || smartd_opts="$*"
a23d5117 594 dep=; dep2=
832b75ed 595 if cygrunsrv -L 2>/dev/null | grep "^syslogd$" >/dev/null 2>&1; then
a23d5117
GI
596 dep="syslogd"
597 fi
598 if cygrunsrv -L 2>/dev/null | grep "^syslog-ng" >/dev/null 2>&1; then
599 dep2="syslog-ng"
600 fi
601 if [ -z "$dep" ]; then
602 if [ -z "$dep2" ]; then
603 echo "Warning: no syslog service installed, smartd will write to windows event log.";
604 else
605 dep="$dep2"
606 fi
832b75ed 607 else
a23d5117
GI
608 if [ -z "$dep2" ]; then
609 :
610 else
611 dep=
612 echo "Warning: both syslogd and syslog-ng installed, dependency not set."
613 fi
832b75ed 614 fi
a23d5117
GI
615 echo "Installing service ${smartd_svcname}${dep:+ (depending on '$dep')}${smartd_opts:+ with options '$smartd_opts'}:"
616 cygrunsrv -I "$smartd_svcname" -d "$smartd_svcdisp" -f "$smartd_svcdesc" ${dep:+-y} $dep \
617 -e CYGWIN="$CYGWIN" -p $SMARTD_BIN -a "-n -p ${PID_FILE}${smartd_opts:+ }$smartd_opts"
832b75ed
GG
618 RETVAL=$?
619 ;;
620 remove)
621 echo "Removing service $smartd_svcname:"
622 cygrunsrv -R "$smartd_svcname"
623 RETVAL=$?
624 ;;
625 status)
626 echo -n "Checking smartd status: "
627 if cygrunsrv -L 2>/dev/null | grep "^${smartd_svcname}$" >/dev/null 2>&1; then
628 if cygrunsrv -Q "$smartd_svcname" 2>/dev/null | grep "State *: Running" >/dev/null 2>&1; then
629 echo "running as service '$smartd_svcname'."
630 elif ps -e 2>/dev/null | grep " ${SMARTD_BIN}$" >/dev/null 2>&1; then
631 echo "installed as service '$smartd_svcname' but running as daemon."
632 else
633 echo "installed as service '$smartd_svcname' but not running."
634 RETVAL=1
635 fi
636 elif ps -e 2>/dev/null | grep " ${SMARTD_BIN}$" >/dev/null 2>&1; then
637 echo "running as daemon."
638 else
639 echo "not running."
640 RETVAL=1
641 fi
642 exit $RETVAL
643 ;;
644 *)
645 echo "Usage: $0 {start|stop|restart|reload|report|status}"
646 echo " $0 {install [options]|remove}"
647 exit 1
648 esac
649
650 if [ "$RETVAL" -eq 0 ]; then echo "done"; else echo "ERROR"; fi
651 exit $RETVAL
652
653# Add other OSes HERE, using elif...
654else
655 report_unsupported "Unknown"
656fi
657
658# One should NEVER arrive here, except for a badly written case above,
a7e8ffec 659# that fails to exit.
832b75ed
GG
660echo "SOMETHING IS WRONG WITH THE SMARTD STARTUP SCRIPT"
661echo "PLEASE CONTACT smartmontools-support@lists.sourceforge.net"
662exit 1