Mercurial > vanilla
comparison system/smartmontools/smartd @ 621:8776fbd72b2f
system/smartmontools: initial import, closes #1655
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 23 Jul 2019 21:05:00 +0200 |
parents | |
children | 657ee4987f4d |
comparison
equal
deleted
inserted
replaced
620:80faeb51a8f7 | 621:8776fbd72b2f |
---|---|
1 #!/bin/sh | |
2 # | |
3 # /etc/rc.d/smartd: run control script for smartd | |
4 | |
5 if [ -f /etc/rc.conf ]; then | |
6 . /etc/rc.conf | |
7 fi | |
8 | |
9 : ${SMARTD_CMD:=/usr/sbin/smartd} | |
10 : ${SMARTD_ARGS:=} | |
11 : ${SMARTD_PID:=/var/run/smartd.pid} | |
12 | |
13 smartd_start() | |
14 { | |
15 echo "Starting smartd: $SMARTD_CMD $SMARTD_ARGS" | |
16 $SMARTD_CMD $SMARTD_ARGS -p $SMARTD_PID | |
17 } | |
18 | |
19 smartd_status() | |
20 { | |
21 if [ -s $SMARTD_PID ]; then | |
22 echo "smartd is running with pid: `cat $SMARTD_PID`" | |
23 else | |
24 echo "smartd is not running" | |
25 fi | |
26 } | |
27 | |
28 smartd_stop() | |
29 { | |
30 if [ -s $SMARTD_PID ]; then | |
31 echo "Stopping smartd." | |
32 kill -QUIT $(cat $SMARTD_PID) | |
33 rm -f $SMARTD_PID | |
34 fi | |
35 } | |
36 | |
37 smartd_restart() | |
38 { | |
39 smartd_stop | |
40 sleep 3 | |
41 smartd_start | |
42 } | |
43 | |
44 case $1 in | |
45 start) | |
46 smartd_start | |
47 ;; | |
48 status) | |
49 smartd_status | |
50 ;; | |
51 stop) | |
52 smartd_stop | |
53 ;; | |
54 restart) | |
55 smartd_restart | |
56 ;; | |
57 *) | |
58 echo "usage: $(basename $0) restart|start|status|stop" | |
59 ;; | |
60 esac |