LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-04-2005, 06:50 AM   #1
novaprime
Member
 
Registered: Jan 2005
Posts: 39

Rep: Reputation: 15
New process w/o current parent?


I have a web server and I want it to play a sound when someone posts a query. I figured I could do it with CGI, so using a small proggy named wavplay (plays a wave file on command line) I wrote a bash script to execute it. However, when the script is executed it returns all text properly (including the text outputed by wavplay when working properly) but the sound isn't heard.

I can only assume it's because the script is running in a restricted mode as a child to apache and it's output is limited to stdout. The best solution I can think of is to somehow tell the kernel to execute a new process that would not be a child to httpd, but I dont know how to do this.

Any ideas?

--script:--
#! /bin/bash
#
echo "Content-type: text/html"
echo ""
echo "<html><head><title>Test Page</title></head><body>"
wavplay /var/www/html/demo.wav
echo "<br><br>Sound played.<br>"
echo "</body></html>"

--output:--
Pathname: /var/www/html/demo.wav Sampling Rate: 44100 Hz Mode: Stereo Samples: 486339 Bits: 16

Sound played.

(what it should be)
 
Old 01-04-2005, 08:09 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
You should be able to sudo the wavplay program.
 
Old 01-04-2005, 09:06 PM   #3
novaprime
Member
 
Registered: Jan 2005
Posts: 39

Original Poster
Rep: Reputation: 15
you are a legend!
thank you (it worked)
 
  


Reply



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
getting parent process ID in sh pradeepp Programming 2 09-22-2005 06:13 AM
Regarding Parent & Chaild Process toraghun Linux - General 1 03-23-2005 08:53 AM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 01:19 PM
about parent and child process winwar Solaris / OpenSolaris 3 07-23-2003 06:07 AM
child and parent process error jdevanand Programming 1 04-29-2002 08:13 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:51 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
Open Source Consulting | Domain Registration