在ubuntu的背景中的PHP脚本

i have a php script. i want to run this in background in ubuntu . i tried using & after the extension .php

php filename.php &

it displays something like : "[1] 15996" this. i dont understand the meaning of this. please someone help me with this. what should i do to run a php script in background. and how do i check it.i used "top" command to check the files running.but,i just showed the terminal is running and does not show the exact file which iam running. pls help me with this too

que: 1) how to run php script in background in ubuntu 2) how do i check whether it is running or not

[1] 15996 means the process is running, and the process id is 15996. There is a good chance the script you're running is done before you manage to find it on your process list, unless you know it is fairly time-consuming. You can check if it is running by doing:

ps -aux | grep 15996

I have done something similar yesterday.

To run a script, just use crond to execute it, you should take a look to this: Executing php with crontab.

To check if it's running you can use ps command, something similar to this:

ps -ef | grep filename.php | grep -v grep > /dev/null
if [ $? -eq 0 ]; then
    echo "running"
else
    echo "not running"
fi

this is my question .i found out the answer for my question .so , i want to share with u all. the answer is

just type the command

nohup php <filename>.php &

the process will start running and u will find the process number like i found "15996".some number.

now type "top" in ubuntu terminal .u will find the process running with the same process number u got

thanks all for anwering my question.

i hope in future this post may help some one

thanks