Question

I want to launch a PHP Process in a Screen session that has not been invoked yet. I do not want to attach to this screen. I will be launching lots of these, by hand at first, then probably with a shell script. I would like to write the output of each to a unique log file ( preferably in /tmp/shell ), but it really doesn't matter where.

This seems close to what I want, but doesn't work:

screen -d -m -X 'php process.php param1 param2'

SOLUTION

Just remove the -X.

This works screen -d -m php process.php param1 param2

Was it helpful?

Solution

I think you need to skip -X:

screen -d -m 'php process.php param1 param2'

It's also useful to give the session a name, especially if you're starting several:

screen -d -m -S mysession 'php process.php param1 param2'

-X is for sending commands to screen itself.

See also: this QA here on SO

Additional explanation

The started screen session will only exist as long as your command is running. When php process.php ... exits, screen will also exit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top