--- /etc/init.d/smartmontools.orig 2005-03-02 21:56:14.061047059 +0100 +++ /etc/init.d/smartmontools 2005-03-02 22:02:38.894334463 +0100 @@ -7,6 +7,8 @@ # loosely based on the init script that comes with smartmontools which is # copyrighted 2002 by Bruce Allen +. /lib/lsb/init-functions + SMARTCTL=/usr/sbin/smartctl SMARTD=/usr/sbin/smartd SMARTDPID=/var/run/smartd.pid @@ -19,18 +21,18 @@ smartd_opts="--pidfile $SMARTDPID $smartd_opts" enable_smart() { - echo -n "Enabling S.M.A.R.T. for:" + log_begin_msg "Enabling S.M.A.R.T. for:" for device in $enable_smart; do - echo -n " $device" + log_begin_msg " $device" $SMARTCTL --quietmode=errorsonly --smart=on $device || \ - { echo -n "(failed)"; RET=2; } + { log_end_msg 1; RET=2; } done - echo "." + log_end_msg 0 } check_start_smartd_option() { if [ ! "$start_smartd" = "yes" ]; then - echo "Not starting S.M.A.R.T. daemon smartd, disabled via /etc/default/smartmontools" + log_warning_msg "Not starting S.M.A.R.T. daemon smartd, disabled via /etc/default/smartmontools" return 1 else return 0 @@ -41,40 +43,40 @@ start) [ -n "$enable_smart" ] && enable_smart if check_start_smartd_option; then - echo -n "Starting S.M.A.R.T. daemon: smartd" + log_begin_msg "Starting S.M.A.R.T. daemon: smartd" if start-stop-daemon --start --quiet --pidfile $SMARTDPID \ --exec $SMARTD -- $smartd_opts; then - echo "." + log_end_msg 0 else - echo " (failed)" + log_end_msg 1 RET=1 fi fi ;; stop) - echo -n "Stopping S.M.A.R.T. daemon: smartd" + log_begin_msg "Stopping S.M.A.R.T. daemon: smartd" start-stop-daemon --stop --quiet --oknodo --pidfile $SMARTDPID - echo "." + log_end_msg 0 ;; reload|force-reload) - echo -n "Reloading S.M.A.R.T. daemon: smartd" + log_begin_msg "Reloading S.M.A.R.T. daemon: smartd" if start-stop-daemon --stop --quiet --signal 1 \ --pidfile $SMARTDPID; then - echo "." + log_end_msg 0 else - echo " (failed)" + log_end_msg 1 RET=1 fi ;; restart) if check_start_smartd_option; then - echo -n "Restarting S.M.A.R.T. daemon: smartd" + log_begin_msg "Restarting S.M.A.R.T. daemon: smartd" start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $SMARTDPID if start-stop-daemon --start --quiet --pidfile $SMARTDPID \ --exec $SMARTD -- $smartd_opts; then - echo "." + log_end_msg 0 else - echo " (failed)" + log_end_msg 1 RET=1 fi fi