-2

Can please anyone help me. i have the following script:

#!/bin/bash

cache_query=$QUERY_STRING
xxx=`echo $cache_query | grep -o 'x=[0-9]*' | sed 's/x=//g'`;  
yyy=`echo $cache_query | grep -o 'y=[0-9]*' | sed 's/y=//g'`;
zzz=`echo $cache_query | grep -o 'z=[0-9]*' | sed 's/z=//g'`; 
let "zzz=18-$zzz"   
content_type=`echo $cache_query | grep -o 'type_image=[a-z]*' | sed 's/type_image=//g'`;
db_name=`echo $cache_query | grep -o 'db=[a-z]*' | sed 's/db=//g'`;     


echo "Content-type: image/"${content_type}
echo ""


case "$db_name" in
"genshtab" ) db_path="/home/bases/gena.sqlite";;
"yasat"    ) db_path="/srv/ftp/upload/yasat.sqlitedb";;
esac


echo "x = " $xxx "y = " $yyy "z = " $zzz "type = " $content_type "database = " $db_name "db_path = " $db_path; #оставляю на всякий $
./tget ${db_path} ${db_name} "/mnt/tmpfs" ${content_type} ${zzz} ${yyy} ${xxx}
cat /mnt/tmpfs/${db_name}/${zzz}/${yyy}/${xxx}.${content_type}

i wrote tget program on c, so if i write

./tget /srv/ftp/upload/yasat.sqlitedb yasat /mnt/tmpfs png 17 0 1

in bash line everything go great, but if i try to call this program from bash script under apache http://46.182.21.31/?type_image=png&db=yasat&x=2&y=1&z=15 the program doesn't start and no errors in my log, is somebody have any ideas why?

3
  • 1
    Did you try giving the full path of tget to get it executed from bash script? Commented Feb 22, 2015 at 22:48
  • possible duplicate of How to parse $QUERY_STRING from a bash CGI script Commented Feb 23, 2015 at 8:48
  • Fix the query string parser and the quoting, then if you still cannot pull it off, try posting a new question with just the minimal case to reproduce your problem. See also stackoverflow.com/help/mcve Commented Feb 23, 2015 at 8:52

1 Answer 1

0

i was resolve a trouble the next way start c program with sudo sudo ./tget ...... and add to /etc/sudoers ability to user www-data to make sudo queries without password

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.