📄 temperaturerecord.txt
字号:
#!/bin/bash# temperatureRecord 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.## temperatureRecord # temperatureRecord is a CGI script. A field target board sends an# HTTP request with the temperature as a parameter.# Apache calls this script setting the $QUERY_STRING variable to the# temperature and $REMOTE_ADDR variable to the sender's IP address.# This script extracts the last octet of the IP address using it# as the location number in an INSERT statement.## Here's the header/content blank separation line required by Apacheecho# Extract the last octet from the sender's IP address, use this# as for the location number.location=`echo $REMOTE_ADDR | cut -f 4 -d '.'`# Get the temperature sent by the target boardtemperature=$QUERY_STRING# Form the INSERT statement and pipe it to mysql.# You have to login in to mysql as trailblazer with# password tb because apache will execute this script as # user www-data not root.echo "INSERT INTO temperatures (location,temperature) \ VALUES ($location,$temperature);" | \ mysql trailblazer --user=trailblazer --pass=tb
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -