D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Running programs that require a terminal - without one.

 

Hi everyone,
 
I've finally tried running it from my code - and it doesn't work - I believe 'screen' requires a terminal as well!! Doh!!
 
So anymore ideas would be welcome!
 
I've tried running lame in silent mode, and redirecting the stdin and stderr to /dev/null e.g.
 
system("lame --silent in_file.mp3 out_file.mp3 1> /dev/null 2> /dev/null")
 
 and nothing works!
 
There must be a standard way running commands that require a terminal without one (i.e. some sort of  terminal emulator program) - I can't of been the first ever person to have this problem!
 
Also doesn't any one know what the mechanics are behind a terminal? - i.e. it can't be just simple stdin and stdout?
 
Google turns up nothing - so I await your help!
 
Cheers
 
Jody

jody salt <jody_leigh_salt@xxxxxxxxxxx> wrote:
Hi Dan,
 
I'll give it ago tommorow (its a bit late now)... I've tried it from the command line and it looks like it should work with my scripts.
 
Any more ideas are also welcome!
 
Thanks for your help.
 
Cheers
 
Jody
 


Daniel Prisk <dan@xxxxxxxxxxxxxxxxx> wrote:
On Thu, 22 Jun 2006 19:33:20 +0100 (BST)
jody salt wrote:

> Hi everyone,
>
> Is there anyway on linux of running programs require a terminal -
> without one?
> I'm trying to run lame - from a system("command here") function in
> php, to resample mp3s, because I want my website users mp3s to be
> automatically resampled as they upload them. The lame command works
> fine from the command line - but not from a standard system("command
> here") function even with absolute paths. It does seems a bit daft to
> have program like lame doesn't have this ability.
> Is there a command that goes something like:
>
> pseudo_terminal [your command]

Have you tried screen? If you use the '-d -m' options then it should
launch the screen session in the background. If you start it with a
specific command then it'll exit when it's finished running. So you'll
want something like: 'system("screen -d -m lame $lame_options")'. Also
might be useful to add a name to the screen with the -S option
(something like the users login name?) so you can easily see what's
doing what when you look at the screen list (screen -ls).

Dan

--
'Violence is the last refuge of the incompetent'
Salvor Hardin

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html


Try the all-new Yahoo! Mail . "The New Version is radically easier to use" ? The Wall Street Journal--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html


The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider.
-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html