 DennisPremium,Mod join:2001-01-26 Algonquin, IL kudos:5 Host: Chicago Users find Hot Deals Users find Hot Dea.. Requests for Hot D.. Home Improvement
1 edit | reply to Sir Meowmix III
Re: running a shell script via cgi web interfacewell, here is the jist of the code...at least the part I am having problems with. I have to remove some bits of it since it's for work and all...
here's teh cgi:
#!/usr/local/bin/perl
print "Content-type: text/html\n\n" ;
print <<EOF ;
<html>
<FORM METHOD=POST ACTION="dennis.sh">
<P><FONT COLOR="#ddd20f" FACE="Trebuchet MS"><B>Enter data to pass to script below </B></FONT><BR>
<INPUT NAME="NAME" TYPE="text" SIZE="25" VALUE="enter your data here"><BR>
</FONT</P>
<P>
<center><INPUT TYPE=submit VALUE="Send">
</center>
</p>
</FORM>
</html>
EOF
exit ;
and here is the shell script called dennis.sh
cat dennis.sh
#!/bin/sh
echo "Content-type: text/plain"
echo
touch /tmp/$1_log.txt
chmod 777 /tmp/$1_log.txt
touch /tmp/$1_cmd.txt
chmod 777 /tmp/$1_cmd.txt
echo copy run $1.cnf force > /tmp/$1_cmd.txt
echo copy $1.cnf binconfs:/$1.cnf force >> /tmp/$1_cmd.txt
echo sh conf exclu int atm \> $1_base.scr >> /tmp/$1_cmd.txt
echo copy $1_base.scr binconfs:/$1_base.scr force >> /tmp/$1_cmd.txt
echo sh conf cat int exclu int gig exclu int fa \> $1_atm.scr >> /tmp/$1_cmd.txt
echo copy $1_atm.scr binconfs:/$1_atm.scr force >> /tmp/$1_cmd.txt
Those touches in the beginning....never happen. I works just fine when I do it from the cli of course...but not via apache. I originally added them in order try and fix this problem but tit seems they don't. And of course the $1 is the variable I'm passing.
When I have it use a pre-existing file (which won't work for me, was only for testing) then this is the ownership I get.
ls -las /tmp/status_out.txt
16 -rwxrwxrwx 1 nobody nogroup 7287 Jun 1 17:04 /tmp/status_out.txt
-- My Blog. Because I desperately need the acknowledgement of others.
Visit the Judd Family website to see my kids! |
|
 nwrickertsand groperPremium,MVM join:2004-09-04 Geneva, IL kudos:7 | Those touches in the beginning....never happen. That's probably because "$1" is undefined. -- AT&T dsl; Westell 327w modem/router; openSuSE 11.0; firefox 3.0.10 |
|
|
|
 DennisPremium,Mod join:2001-01-26 Algonquin, IL kudos:5 Host: Chicago Users find Hot Deals Users find Hot Dea.. Requests for Hot D.. Home Improvement
2 edits | said by nwrickert:Those touches in the beginning....never happen. That's probably because "$1" is undefined. ....ok well so if that's the case then if the touches are indeed happening, there must be frament files in the /tmp directory...
49# ls -las /tmp/*.txt
16 -rwxrwxrwx 1 nobody nogroup 219 Jun 2 09:28 /tmp/_cmd.txt
0 -rwxrwxrwx 1 nobody nogroup 0 Jun 2 09:28 /tmp/_log.txt
so yeah, ok.....the variable must not be passing. So $1 is just a cli variable, and $HTTP_POST would be necessary in its stead.
I'll try that and see what happens.
-- My Blog. Because I desperately need the acknowledgement of others.
Visit the Judd Family website to see my kids! |
|