Welcome to WebmasterWorld Guest from 54.205.20.160

Forum Moderators: bakedjake

Message Too Old, No Replies

Run a Command and Exit SSH

   
2:52 pm on Jan 3, 2008 (gmt 0)

5+ Year Member



Hello,

I login to the server over SSH.

I am looking for a way that would allow me to run a command and then be able to exit SSH.

$ php script.php

The ampersand after the command does not work. The command goes into the background allright. However, the command terminates after I close the SSH window.

Any ideas and tips appreciated.

Thanks.

4:19 pm on Jan 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can try using the screen command.

[rackaid.com ]

6:47 pm on Jan 3, 2008 (gmt 0)

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



You can use the nohup (no hangup) command for this.

For example:

nohup php script.php &

Output and error messages are automatically placed in the file nohup.out in the current directory.

5:02 pm on Jan 4, 2008 (gmt 0)

WebmasterWorld Senior Member wheel is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I use the screen command myself in this situation.