Need help with cgi and so on


 
Thread Tools Search this Thread
Top Forums Web Development Need help with cgi and so on
# 1  
Old 10-31-2009
Need help with cgi and so on

Hello all, i`m new here and new in programming with cgi. But i need it for my running project. I`ve googled half a week with no success.

All i need is to run an .sh-file via cgi.

My file is stored in /home/bots/

but if i try
Code:
#!/bin/sh

echo 'Content-type: text/html'
echo

echo '<html>'
echo '<body>'
echo '<center><h1>'

/home/bots/logout.sh

echo '</h1></center>'
echo '</body>'
echo '</html>'

i get an error message. In the logout.sh i make some stuff with screen and i get the message:
No screen session found.

But i`m sure there is running a session.
if i log in into the shell all is working fine.
# 2  
Old 10-31-2009
What web server and version are you running? What platform? Linux? Solaris? Windows XP?
# 3  
Old 10-31-2009
There might be a screen session for your user, but is there one for the user the web server is running as? Remember, a user isn't allowed to access the sessions of any other user.
# 4  
Old 10-31-2009
Have running an

Apache/2.2.8 (Linux/SUSE).

is it possible to login as the user the screen is running at with cgi-script?
# 5  
Old 10-31-2009
Normally with Apache server you must configure the CGI directives and directory. There are rules where the CGI directory can reside.

My first guess is that you have not configured Apache correctly to run CGI scripts and that you can't run CGI in your /home/bots/ directory.

Take a look at this page from Apache, Configuring Apache to permit CGI.
# 6  
Old 11-01-2009
Ok, done all but no success.
I would make all new if someone can give me step by step instructions.
All i wanne do is to run an .exe-file in an screen session.
start it with:

mono my.exe

This programm should run in an screen - session.
And now i want to send commands to this programm.
The commands should come from web.
Smilie

---------- Post updated at 01:44 PM ---------- Previous update was at 07:50 AM ----------

Ok, forget my previos post.

I have played a litte and found something that makes me wonder.

My logut.cgi
Code:
#!/bin/sh

echo 'Content-type: text/html'
echo

echo '<html>'
echo '<body>'
echo '<center><h1>'


sudo -u username /home/bots/logout.sh

echo '</h1></center>'
echo '</body>'
echo '</html>'

And i edited the sudoers like:

Code:
username   ALL=(ALL) NOPASSWD: /home/bots/logout.sh

If i check the error_log i find:

Code:
[Sun Nov 01 17:13:25 2009] [error] [client ***.***.***.***] usernames's password:

Where is here the problem? I think the path is right.

Last edited by cryp0r; 11-01-2009 at 02:52 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CGI Perl : while loop in CGI perl

Hi Team, I am trying to connect to database(succeeded ) and print the records on the browser using while loop. But the elements of array are not displayed instead while loop is displayed directly. Instead of the below I can embed html statements in print but I am looking for the below style as I... (1 Reply)
Discussion started by: scriptscript
1 Replies

2. Shell Programming and Scripting

Perl CGI : unable to download the excel sheet from perl cgi page

Hi All, I have written an cgi perl script that displays an image(Excel image) and when clicked on that Image I need to download a excel sheet. I made sure that excel sheet exists in the folder with the given name but still I am not able to download the sheet. print "<center><table... (2 Replies)
Discussion started by: scriptscript
2 Replies

3. Shell Programming and Scripting

Perl cgi pages out of cgi-bin folder in WINDOWS

Hi team, I have a typical problem with cgi pages in apache webserver in WINDOWS I am able to execute(display) the pages that are saved in cgi-bin folder. But I am not able to execute the pages stored in htdocs or other folder other than cgi-bin folder. Could anyone please let me know how... (1 Reply)
Discussion started by: scriptscript
1 Replies

4. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

5. Solaris

apache ErrorDocument 400 /cgi-bin/400.cgi

Hi All, Sorry if the question is trivial for you but, I am new to Apache (2.0.63) and am trying to figure out how to display my 400.cgi. Here is what I have in httpd.conf servername testing DocumentRoot "/usr/local/apache2/htdocs" ErrorDocument 400 /cgi-bin/badrequest-400.cgi Here is... (0 Replies)
Discussion started by: afadaghi
0 Replies

6. UNIX for Dummies Questions & Answers

Running cgi

I am learning about cgi and having lots of trouble. If I am on a server cs-srv2.(schoolname).edu and I want to run cgi script what would I need to do? By the way, I see $ on the command line when my server opens , if that makes a difference. I created a cgi-bin directory and put it in there. The... (3 Replies)
Discussion started by: CSGUY
3 Replies

7. Shell Programming and Scripting

CGI problem

1. I need CGI in my own server. plz tell me how do it ? 2. U know somethink FREE servers with CGI ? thanks cYa (2 Replies)
Discussion started by: kezzol
2 Replies

8. Shell Programming and Scripting

CGI passing arrays/hashes to another CGI script

If I have a Perl CGI script (script01), which fills an array(s) with information and outputs a HTML page with a link to another CGI page (script02); is there anyway to pass the array(s) from "script01" to "script02" when the page visitor clicks the link? Hope that makes sense! :) (2 Replies)
Discussion started by: WIntellect
2 Replies

9. Shell Programming and Scripting

cgi

I am having trouble running my perl cgi on the Internet. After i put the cgi file into the public_html directory and try to browse it on the internet, it returns me the exact content of the cgi file. Is the file permission 755 for the cgi file correct? My path to perl is something like ... (2 Replies)
Discussion started by: vince
2 Replies

10. Shell Programming and Scripting

Perl CGI.pm

my box is FreeBSD4.3 and I use Perl 5.0005_03. Here is the CGI script. test.cgi ...... if ($query->action eq 'detail') { ...... print $query->hidden('action', 'modify'); ...... } I found that the result of test.cgi?action=detail is not what I expected. the script does not... (4 Replies)
Discussion started by: tonyt
4 Replies
Login or Register to Ask a Question