LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-03-2010, 02:57 AM   #1
G-Fox
Member
 
Registered: Jul 2003
Location: Lithuania
Posts: 45

Rep: Reputation: 15
screen command issue with redirecting STDOUT


Hello,

try to do:

screen -dmS test 'ls > result.txt'

no result.txt file created...

If I put command 'ls > result.txt' in shell script test.sh and run:

screen -dmS test ./test.sh

result.txt file was created and have list of files, but I need to work without shell script.

My main task is to run multiple perl scripts from php web site in bacground and display perl script output in web without hangup or waiting for script to finish.

If someone have better solution than screen it will be very wellcome.

Thanks.
 
Old 12-03-2010, 03:40 AM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by G-Fox View Post
Hello,

try to do:

screen -dmS test 'ls > result.txt'

no result.txt file created...

If I put command 'ls > result.txt' in shell script test.sh and run:

screen -dmS test ./test.sh

result.txt file was created and have list of files, but I need to work without shell script.
Try to use double quotes instead. I can't be sure it will work, it really depends on how screen does the parsing of the input. But it's worth a try.

Code:
screen -dmS test "ls > ~/result.txt"

Quote:
My main task is to run multiple perl scripts from php web site in bacground and display perl script output in web without hangup or waiting for script to finish.

If someone have better solution than screen it will be very wellcome.
I am not sure this is the right approach, never looked into it myself. But there must be some tty library that you can use instead, like vte. In any case, if you prefer a terminal multiplexer for some reason, you should look into tmux which should be lighter. That's one thing to try if no one can give a better advise.
 
Old 12-03-2010, 04:29 AM   #3
G-Fox
Member
 
Registered: Jul 2003
Location: Lithuania
Posts: 45

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by i92guboj View Post
Try to use double quotes instead. I can't be sure it will work, it really depends on how screen does the parsing of the input. But it's worth a try.

Code:
screen -dmS test "ls > ~/result.txt"
Same result... no file created.

Quote:
Originally Posted by i92guboj View Post
I am not sure this is the right approach, never looked into it myself. But there must be some tty library that you can use instead, like vte. In any case, if you prefer a terminal multiplexer for some reason, you should look into tmux which should be lighter. That's one thing to try if no one can give a better advise.
Problem solved will use in command end '&'.
Code:
exec('script.pl &> log &');
 
  


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
[SOLVED] redirecting STDOUT of previous command to STDIN of next command urban.yoga.journeys Linux - General 9 11-22-2009 03:16 AM
Redirecting stdout instantaneously... ramesh6056 Linux - Software 8 10-04-2007 11:15 AM
redirecting stdout to /dev/null and stderr to stdout? Thinking Programming 1 05-18-2006 02:36 AM
Redirecting to file and stdout Quantum0726 Programming 3 11-14-2005 08:35 PM
Redirecting stdout to tar hari_s_82 Linux - Newbie 6 10-08-2004 01:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:28 PM.

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