07-25-2008
Export system temperature to variable
I have a Korn shell that successfully queries the system temperature of my server. I am able to use the envmon env_current_temp to display just the last 2 characters of output. The full output is:
envmon:
env_current_temp = 36
I tried writing the value (36) out to txt, then reading the txt file as a variable, but I am stuck.
If I hardcode curt=36 then it works fine, so I think it is just a matter of getting the 2 last characters into a numeric variable.
#! /bin/ksh
echo Temperature
/sbin/sysconfig -q envmon env_current_temp | cut -b20-21
echo $curt
#fdeg=$(echo "scale=2; ($curt*9/5) +32" | bc -l)
#kdeg=$(echo "scale=2; ($curt+273.15)" | bc -l)
#echo "$curt Celsius $fdeg Fahrenheit $kdeg Kelvin"
Any help would be greatly appreciated.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How to export variables on a UNIX prompt. Please provide me syntax.
Thanks in advance.
Malay (5 Replies)
Discussion started by: malaymaru
5 Replies
2. UNIX for Dummies Questions & Answers
I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so:
set -a
export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data"
export... (2 Replies)
Discussion started by: ParNone
2 Replies
3. Filesystems, Disks and Memory
Hi...
Is it possible to re-export a exported NFS file system? If no, Why?
Let me know, if any further details are required about the question.
Thanks in advance
Adams:) (5 Replies)
Discussion started by: Adams Nave
5 Replies
4. Filesystems, Disks and Memory
Hi,
Is there a way we can export a file system with write permissions for only one user.
For eg. we have many users on the network, but only user2 should have write permissions on the exported file system and for others it should be read-only. (7 Replies)
Discussion started by: jredx
7 Replies
5. Shell Programming and Scripting
How to export variable from one script to other?
Can anybody give me syntax for that?
Thanks (2 Replies)
Discussion started by: navi
2 Replies
6. Shell Programming and Scripting
Hi
I have a pass a variable from one script to another.
Here are my scripts
Script #1 ./profile
#!/bin/sh
export NAME="Hello"
Script #2 ./test
#!/bin/sh
./profile
echo $NAME
when I run ./test .. i am not getting anything .. why is that? (5 Replies)
Discussion started by: arex876
5 Replies
7. Shell Programming and Scripting
Hi, Unix Gurus,
I have a problem need help. I have a script to generate environment variable code same as following:
oracle_sid=abcd
export oracle_sid
when I execute this code with command ./script_nane it succeeded.
when I try to find it with env command or echo $oracle_sid, it does not show... (5 Replies)
Discussion started by: ken002
5 Replies
8. Shell Programming and Scripting
Hello Guys,
I need you help to do one task
I have script which is actually doing to fetch the code of any repository in svn
for e.g.:- I can use svn to checkout the repository but I want to checkout the repository for particular tag
like svn co <url>/svn/repo/<tag-name>
and this... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies
9. Shell Programming and Scripting
I am relatively new to exporting variables, and I just can't seem to make this count work. What I have is the following:
TOTAL=$($IMAGELIST -backupid $IM -U |gawk '{print $5}' |tail -1)|gawk '{print $6}'
RESTORED=$($BPDBJOBS -most_columns -jobid $JOBS |cut -f15 -d,) |gawk '{print $6}'
export... (7 Replies)
Discussion started by: newbie2010
7 Replies
10. UNIX for Advanced & Expert Users
Hi,
Please find my code below.
ps -xef | grep 14766 | awk 'BEGIN{X="java_home=";X="weblogic_home="}
{for(i=1;i<=NF;i++){if($i ~ /-Dplatform\.home|java$/){split($i,P,"=");s=P?P:$i;print X""s}}}'
echo "java_home="$java_home
echo "weblogic_home="$weblogic_home
Output:
Why does... (3 Replies)
Discussion started by: mohtashims
3 Replies
LM75(4) BSD Kernel Interfaces Manual LM75(4)
NAME
lm75 -- lm75 i2c digital temperature sensor driver
SYNOPSIS
device iic
device iicbus
device lm75
DESCRIPTION
The lm75 driver provides access to sensor data and configuration over the iicbus(4).
It provides an easy and simple way to check the functionality of an i2c bus as it provides read and write access to the lm75 configuration
register.
The access to lm75 data is made via the sysctl(8) interface:
dev.lm75.0.%desc: LM75 temperature sensor
dev.lm75.0.%driver: lm75
dev.lm75.0.%location: addr=0x49
dev.lm75.0.%pnpinfo: name=lm750 compat=national,lm75
dev.lm75.0.%parent: iicbus3
dev.lm75.0.temperature: 27.1C
dev.lm75.0.thyst: 75.0C
dev.lm75.0.tos: 80.0C
dev.lm75.0.faults: 1
dev.lm75.0.mode: comparator
dev.lm75.0.polarity: active-low
dev.lm75.0.shutdown: 0
dev.lm75.%d.temperature Is the read-only value of the current temperature read by the sensor.
dev.lm75.%d.thyst Sets the hysteresis temperature. Once the temperature gets over the overtemperature shutdown value (tos) it needs
to drop below the hysteresis temperature to disable the output (interrupt) pin again.
dev.lm75.%d.tos Sets the overtemperature shutdown value. Once the temperature gets over this value the output pin will be enabled.
The way the output (interrupt) pin works, depends on the mode configuration.
dev.lm75.%d.faults Is the number of faults that must occur consecutively to activate the interrupt (output) pin. It can be set to 1,
2, 4, and 6.
dev.lm75.%d.mode Sets the operation mode for the sensor interrupt pin. It can be set to 'comparator' (default) or 'interrupt'.
dev.lm75.%d.polarity Sets the polarity of the sensor interrupt pin. It can be set to 'active-low' (default) or 'active-high'. Please
note that the output pin is an open-drain output and it needs a proper pull-up resistor to work.
dev.lm75.%d.shutdown When set to '1' it shuts down the sensor. The temperature conversion stops but the sensor remains with its i2c bus
active, i.e., it can be woken up by setting this option to '0' again.
Please check the lm75 datasheet for more details.
When used together with snmp_lm75(3) it allows the monitoring of lm75 temperature data over SNMP.
The lm75 driver supports both the low and the high resolution models.
The low resolution model (lm75) provides a 9 bit output with the LSB representing 0.5C.
The high resolution model (lm75a) provides an 11 bit output with the LSB representing 0.125C.
The driver tries to auto-detect the lm75 model, but the detection of some lm75 clones may not work reliably.
On a device.hints(5) based system, like MIPS, these values are configurable for lm75:
hint.lm75.%d.at Is the iicbus(4) you are attaching to.
hint.lm75.%d.addr Is the lm75 i2c address on the iicbus(4).
On a FDT(4) based system, like ARM, the DTS part for a lm75 device usually looks like:
i2c {
...
lm750 {
compatible = "national,lm75";
i2c-address = <0x49>;
};
};
Where:
compatible Should always be set to "national,lm75".
i2c-address The i2c-address property indicates which i2c address the lm75 is wired at. lm75 temperature sensors can be wired to 8 different
addresses, allowing up to 8 sensors on the same iicbus(4).
SEE ALSO
snmp_lm75(3), fdt(4), iic(4), iicbus(4), sysctl(8)
HISTORY
The lm75 driver first appeared in FreeBSD 11.0.
AUTHORS
The lm75 driver and this manual page were written by Luiz Otavio O Souza <loos@FreeBSD.org>.
BSD
May 11, 2014 BSD