📄 temperaturereport.txt
字号:
#!/bin/bash# temperatureReport v1.0 12/31/01# www.embeddedlinuxinterfacing.com## The original location of this code is# http://www.embeddedlinuxinterfacing.com/chapters/12/## Copyright (C) 2001 by Craig Hollabaugh## This program is free software; you can redistribute it and/or modify# it however you want.## temperatureReport # temperatureReport is a bash script that executes on a target board# with an external temperature sensor and its module loaded. Loading# the module, such as LM70_x86.o from Chapter 10 creates the# /proc/trailblazer/temperature file. This script gets the current# temperature from /proc/trailblazer/temperature, forms an HTTP GET# query using temperatureRecord with the temperature as the # parameter. This query is piped into nc which makes a TCP connection# to tbdev1's apache HTTP server on port 80. nc is configured with# the -w flag which sets a connection timeout. If tbdev1's apache # server doesn't answer, this script will continue to operate.## Call this from inittab using the respawn option as in# T3:23:respawn:/usr/bin/temperatureReport# If temperatureReport should die, init will start it again## loop foreverwhile [ 1 ]do# get temp temperature=`cat /proc/trailblazer/temperature`# form the query and pipe to nc echo "GET /cgi-bin/temperatureRecord?$temperature" \ | nc -w 10 192.168.1.11 80# print out temperature echo $temperature# pause for 5 minutes sleep 300done
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -