imagegetlast.txt

来自「这是《嵌入式linux-硬件、软件与接口》一书对应的所有linux方面实例的源代」· 文本 代码 · 共 40 行

TXT
40
字号
#!/bin/bash
# imageGetLast 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.
#
# imageGetLast 
# imageGetLast is a CGI script. A web service sends an HTTP 
# request with a Trailblazer location number as a parameter. 
# Apache calls this script setting the $QUERY_STRING variable 
# to the location number. This script forms a SELECT statement 
# that returns the filename stored in /tftpboot/i386-rootfs/tmp.
#
# Here's the Content-type line to tell the browser that this reply
# is a jpg image.
echo Content-type: image/jpeg 

# Here's the header/content blank separation line required by Apache
echo

# Set the location
location=$QUERY_STRING

# Form the SELECT 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. Redirect the output to a temp file.
filename=`echo "SELECT filename from images where location = $location \
      order by timestamp desc limit 0,1" | \
      mysql trailblazer --user=trailblazer --pass=tb --silent`

# cat the file out to the browser
cat /tftpboot/i386-rootfs/tmp/$filename

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?