I have started a small project just for my practice in home. I am using a raspberry pi with debian linux,installed apache webserver 2 on the board,i have no idea on webserver but some how managed to create html page with button on it and cgi script running with button click.Cgi script has html code which respond to button click. Displays hello world followed by command invokes shell script .sh.
shell script has following command RPI.a(my project in c lang which invokes gpio pin running excellent when executing .cgi script in command line.
1)Overall Html button click ->2)invokes cgi script(shell with html)->3)invokes shell(.sh)-> which invokes my application blinking led.
Running good when executing .cgi manually from command line.but when on button click from html it skips "$(sh script.sh) and executes next line.
Permissions all the files has read and execute for all files.
.cgi script
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo "<html><head><title>Bash as CGI"
echo "</title></head><body>"
echo "<h1>Hello world</h1>"
"$(sh Home_auto.sh)"
echo "skipps the program"
echo "</body></html>"
My Home_auto.sh script
sudo RPI.a<<EOF
EOF
ADDED my application Dir to $PATH var.
I found out that it is not able to execute my application few times when not being a root user.Display's RPI.a command not found Please help me with invoking script.sh which will invoke my RPI.a application on button click.
Hello world
" "$(sh Home_auto.sh)" echo "skipps the program" echo "" – user3232919 Jan 25 '14 at 05:55