9.1 Pro: Error message from /etc/cron.daily/suse.de-check-battery
When the /etc/cron.daily/suse.de-check-battery script runs, it produces an error message: suse.de-check-battery: line 28: okay: command not found If I run it with sh -x, I get this output: seahunt:/etc/cron.daily # sh -x suse.de-check-battery + umask 022 + PATH=/sbin:/bin:/usr/sbin:/usr/bin + export PATH + test -r /proc/driver/rtc ++ awk '$1 == "batt_status" { print $3 }' /proc/driver/rtc + BATT_STATUS=okay + test -r /proc/rtc + test -n okay + okay '!=' okay suse.de-check-battery: line 28: okay: command not found + exit 0 The script looks like this: #!/bin/sh # # # Copyright (c) 2002 SuSE Linux AG, Nuernberg, Germany. # # please send bugfixes or comments to http://www.suse.de/feedback. # # # paranoia settings # umask 022 PATH=/sbin:/bin:/usr/sbin:/usr/bin export PATH # # check CMOS Battery # test -r /proc/driver/rtc && \ BATT_STATUS=$(awk '$1 == "batt_status" { print $3 }' /proc/driver/rtc) test -r /proc/rtc && \ BATT_STATUS=$(awk '$1 == "batt_status" { print $3 }' /proc/rtc) test -n "$BATT_STATUS" && "$BATT_STATUS" != "okay" && \ echo "CMOS battery empty -- expect problems" exit 0 The syntax looks OK to me, I don't understand what the problem is. I have reported this to SuSE, as it happens on both machines on which I have installed 9.1 Pro. BTW, /proc/driver/rtc looks like this: seahunt:/etc/cron.daily # cat /proc/driver/rtc rtc_time : 04:39:33 rtc_date : 2004-06-08 rtc_epoch : 1900 alarm : 03:20:43 DST_enable : no BCD : yes 24hr : yes square_wave : no alarm_IRQ : no update_IRQ : no periodic_IRQ : no periodic_freq : 1024 batt_status : okay seahunt:/etc/cron.daily # ...so the battery is OK, and this is just a minor error, but I'd still like to understand why the script produces that output.
On Tuesday 08 June 2004 13.40, Michael Nelson wrote:
test -n "$BATT_STATUS" && "$BATT_STATUS" != "okay" && \ echo "CMOS battery empty -- expect problems"
exit 0
The syntax looks OK to me, I don't understand what the problem is.
The problem is that "$BATT_STATUS" != "okay" isn't a valid bash command. Replace the line with something like test -n "$BATT_STATUS" && test "$BATT_STATUS" != "okay" && \
On Tue, Jun 08, 2004 at 06:39:49PM +0200, Anders Johansson wrote:
On Tuesday 08 June 2004 13.40, Michael Nelson wrote:
test -n "$BATT_STATUS" && "$BATT_STATUS" != "okay" && \ echo "CMOS battery empty -- expect problems"
exit 0
The syntax looks OK to me, I don't understand what the problem is.
The problem is that "$BATT_STATUS" != "okay" isn't a valid bash command. Replace the line with something like
test -n "$BATT_STATUS" && test "$BATT_STATUS" != "okay" && \
Ooops! You are correct, and that fixes it. Thanks! Michael
participants (2)
-
Anders Johansson
-
Michael Nelson