php调用shell程序出现僵尸程序defunct

php调用bash shell
[php]
system("/home/app/clean_queue.sh", $retval);
[/php]

clean_queue.sh如下:
[bash]
#!/bin/bash
sid="/data/httpsqs/queue"
pid=`ps -ef|grep -v grep|grep $sid|sed -n ’1P’|awk ‘{print $2}’`
while [ -n "$pid" ]
do
echo "queue id=$pid"
kill $pid
pid=`ps -ef|grep -v grep|grep $sid|sed -n ’1P’|awk ‘{print $2}’`
done

echo "has shutdown queue."
rm -rf /data/httpsqs/queue/httpsqs.db
echo "has delete queue db."

/usr/bin/httpsqs -d -p 1234 -x /data/httpsqs/queue
echo "has restarted page queue"

pid2=`ps -ef|grep -v grep|grep $sid|sed -n ’1P’|awk ‘{print $2}’`
while [ -z "$pid2" ]
do
echo "queue has not been started, ready to retry."
/usr/bin/httpsqs -d -p 1234 -x /data/httpsqs/queue
pid2=`ps -ef|grep -v grep|grep $sid|sed -n ’1P’|awk ‘{print $2}’`
done
echo "end check if started"
[/bash]

但执行的时候此段php代码始终不结束
[bash]
[root@script ~]# ps -ef|grep defunct
root 11273 21369 0 16:58 pts/0 00:00:00 php test_defunct.php
root 11275 11273 0 16:58 pts/0 00:00:00 [sh] <defunct>
root 11384 13877 0 16:59 pts/2 00:00:00 grep defunct
[/bash]

刚开始看到/usr/bin/httpsqs的背景颜色是红色的,以为是权限的问题,后来chmod u-s /usr/bin/httpsqs去掉suid属性还是问题依旧。
后来感觉是不是httpsqs启动后是deamon程序,调用的php一直判断这个shell没结果,就一直等,尝试加上nohup后台执行,如下面的写法:
[bash]
system("nohup /home/app/clean_queue.sh > /home/app/log/clean_queue 2>&1", $retval);
[/bash]
果然就不出僵尸进程了。