LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-14-2005, 02:45 PM   #1
gothrog
Member
 
Registered: Jun 2004
Distribution: Yellow Dog, Fedora, RedHat, Centos, Ubuntu, Suse Linux
Posts: 106

Rep: Reputation: 15
Question Apache DSO question.


Hello,

I'm new to DSO and I am trying to figure out whether or not using DSO can help me.

Does anyone know of a DSO module in apache2 that can execute another program as if it came from a command prompt?

I am attempting to have a cgi script launch another program from within a browser. If someone can point me in the right direction it would be greatly appreciated.

Mike
 
Old 03-14-2005, 04:05 PM   #2
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
I have very little experience with DSO, but if you place a shellscript similar to the following example in your cgi-bin, you can run shell commands directly..

This is a little prank image I made a few years back, the file is named sword.gif:
Code:
#!/bin/bash
echo "Content-type: image/gif";
RND=`expr \( $RANDOM \* 4 \) / 32767 + 1 `
echo
REMOTE_ADDR=${REMOTE_ADDR:-$REMOTE_ADDR}
pbmtext "$REMOTE_ADDR" > /tmp/ip
pnmcomp -invert -alpha /tmp/ip /tmp/ip /var/www/artanicus/admin/pics/$RND > /tmp/sword.pnm
ppmtogif /tmp/sword.pnm > /tmp/sword.gif

cat /tmp/sword.gif

Last edited by Artanicus; 03-14-2005 at 04:06 PM.
 
Old 03-14-2005, 05:44 PM   #3
gothrog
Member
 
Registered: Jun 2004
Distribution: Yellow Dog, Fedora, RedHat, Centos, Ubuntu, Suse Linux
Posts: 106

Original Poster
Rep: Reputation: 15
Art,

I'm actually already doing this, but the program terminates upon completion. I have the operator input something through the browser and it executes a program. Although the apache seems to somehow lose the process.

I'll grep for the program and find it, but it is like it is in limbo.

ps -ef | grep (name)
root 22817 1 0 17:17 ? 00:00:00 /usr/local/(full path)

This is how it should look like:
root 22976 1 0 17:26 pts/2 00:00:00 /usr/local/(full path)

It doesn't seem to know what to do with it, but maybe that is my problem. The program is just supposed to be a background process that does not get killed until the operator tells it too.

It is being launched by a system() call. Does anyone know how system() calls work with apache? It seems like it will only execute that one call and after that call it immediately terminates.

Mike
 
Old 03-15-2005, 01:03 AM   #4
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
aa.. Now I see what you mean.. So far I havnt figured any way to run it in a shell environment instead of the usual background limbo.. Now, one bubblegum solution comes to mind.. Make a screen, and then have the script give the command for the screen to be executed.. I think it had some commandline parameter like that..

But, im sure theres some neat solution also..
 
Old 03-15-2005, 11:25 AM   #5
gothrog
Member
 
Registered: Jun 2004
Distribution: Yellow Dog, Fedora, RedHat, Centos, Ubuntu, Suse Linux
Posts: 106

Original Poster
Rep: Reputation: 15
thanks Art. I'm goig to continue this in another thread titled more appriopriately.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache question gsgleason Linux - Software 7 06-03-2005 09:50 AM
How to find out if DSO support is included in Apache installation? john lee Linux - Newbie 3 05-04-2005 04:35 AM
Apache2 and mod_ssl as a DSO Rumblefish Linux - Software 1 12-01-2004 04:25 PM
Compiling PHP WITHOUT dso (--with-apxs) jimieee Linux - Software 0 04-29-2004 07:28 AM
php DSO stupidity Kilka *BSD 5 01-08-2004 04:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration