I use owread in my bash scripts,  as I log in rrdtools if I find the data is
not available I set the variable to "U" and send a message to nohup.  I test
for no data returned and if the value is greater than my upper range.  i.e.
for DS18B20 if it comes back with the magical 85 it reports as an error.

### Read 1wire data and convert into engineering units  offset was 0.3 ##
PH=$($OWREAD 20.E59A0D000000/volt.A | $AWK ' {printf
"%4.2f\n",(($0-0.0)-1)/1.6+5.5 }')

### Out of Range Error trap -Do not log data ###
PHtest=`echo $PH |cut -f1 -d'.'`
if [ -z $PHtest ] || [ $PHtest -gt 8 ]; then
echo "`date` PH reading error $PH" >>/var/scripts/nohup.out
PH="U"
fi



-----Original Message-----
From: Alessio Sangalli [mailto:[email protected]] 
Sent: Saturday, 12 February 2011 8:28 AM
To: OWFS (One-wire file system) discussion and help
Subject: [Owfs-developers] Exit code

Hi, I am using the owshell family of commands, usually from scripts; I
usually capture the output of the command into a variable:

temperature=$(owread /26.79D891000000/temperature)

sometimes for whatever reason - owread fails, maybe because owserver is not
up (yet) or similar.

How do I detect the "error" condition? The man page of "owshell" does not
mention any exit code "strategy". I had a look at the source so it seems the
exit code is 0 if successful and 1 if error - but is there an "official"
behaviour?

Basically the question is: how can I use owshell reliably with error
checking and reporting from a script?

bye
as



----------------------------------------------------------------------------
--
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to