diff options
author | Peter Palfrader <peter@palfrader.org> | 2006-05-29 03:33:29 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2006-05-29 03:33:29 +0000 |
commit | 36292f85732f6ba51df2acee74a561f588eb430c (patch) | |
tree | 4be9af4179ebcb9e7bf3d2fb4f223293d7e8bac9 /munin/owfs_temperature_ | |
parent | 9ffb6d6386f5d689776cb11c133deaebea5c3eee (diff) |
owfs is weird
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@108 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'munin/owfs_temperature_')
-rwxr-xr-x | munin/owfs_temperature_ | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/munin/owfs_temperature_ b/munin/owfs_temperature_ index 3c87c21..dfdf883 100755 --- a/munin/owfs_temperature_ +++ b/munin/owfs_temperature_ @@ -75,9 +75,29 @@ end def report device = query_device - temp = File.new($owfs_path+'/'+device+'/temperature').read - n = normalize_sensor device - puts "#{n}.value #{temp}" + Process.gid=0 + Process.egid=0 + temp = nil + # fuse does weird checks. this fails: + # File.new($owfs_path+'/'+device+'/temperature', "r") ---> FAILS: in `initialize': Permission denied - /var/lib/owfs/10.D234EE000800/temperature (Errno::EACCES) + IO.popen("-") do |f| + unless f # child + begin + exec('cat', $owfs_path+'/'+device+'/temperature') + rescue => e + puts "Cannot exec cat: "+e.message + exit 1 + end + end + temp = f.readlines + end + + if $? != 0 + STDERR.puts "Child exited with non-zero exit code(%d): %s"%[$? >> 8, temp.join('')] + else + n = normalize_sensor device + puts "#{n}.value #{temp.join('')}" + end end |