[SOLVED] Put a process in foreground with his PID
Hi,
I'm sorry for my poor english but I'm French. I try to run a command trough a php page. There's my command: system('bash -c \"screen -dm rtorrent\"'); I think the command is working fine because when I log on by ssh on my Debian server I can see the screen process with "ps -A" command. But if I type "screen -ls" in a shell, I don't see anything... The command "jobs" don't return anything too, it's why I can't use "fg"... Maybe that's "screen" the problem. But if I try with "nohup...&" I don't know how to retrieve my process in foreground... Thank's for any help ! |
What user does the php script run under? If you are not logged in as that user then I believe you would not be able to see his screen sessions with the:
screen -ls But you could still see the screen process running when you issue the ps -A command. You might sudo to your php user and then try: screen -ls Regards, Fordeck |
I have 3 users. The user "www-data" in the "www-data" group used by Apache. The php script run under this user.
Normally, I log on by ssh on my server with the user "gagou" in the group "www-data" and I can't see the screen started by "www-data". I try with another user "local" in the group "www-data" and I can't see the screen started by "www-data" too. But if I run a screen with the user "gagou", then log off and log on with the user "local", I can see and attach the screen started by "gagou". All 3 users are in the same group. I don't know where's the problem. I would try with sudo and post the result. Thank's a lot. [EDIT] I found a solution. In your php script, if you do this: Code:
system('screen -dmS rTorrent rtorrent'); The correct command is: Code:
system('/bin/bash -c "/usr/bin/screen -dmS rTorrent /usr/bin/rtorrent"'); If you want to retrieve the screen when you connect for example by ssh, you must do this to see all screen started by the php script: Code:
:~$ sudo -u www-data screen -ls Code:
:~$ sudo -u www-data screen -r rTorrent Maybe you will have this error: Code:
:~$ sudo -u www-data screen -r rTorrent Code:
:~$ chmod a+rw /dev/pts/0 [/EDIT] |
All times are GMT -5. The time now is 11:03 PM. |