+ -
当前位置:首页 → 问答吧 → 允许后台执行进程exec("binary > /dev/null &") 怎么操作啊

允许后台执行进程exec("binary > /dev/null &") 怎么操作啊

时间:2011-11-07

来源:互联网

求助 安装一个PHP程序,CENTOS5系统 程序要求服务器 允许后台执行进程exec("binary > /dev/null &") ,不知道要怎么操作呢,服务器是自己管理的,本人刚接触LINUX不太懂,求高手指点,3Q

作者: nmxkxp   发布时间: 2011-11-07

C/C++ code
NAME
       daemon - run in the background

SYNOPSIS
       #include <unistd.h>

       int daemon(int nochdir, int noclose);

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       daemon(): _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)

DESCRIPTION
       The daemon() function is for programs wishing to detach themselves from the controlling terminal and run in the background as system daemons.

       If  nochdir  is zero, daemon() changes the calling process's current working directory to the root directory ("/"); otherwise, the current working
       directory is left unchanged.

       If noclose is zero, daemon() redirects standard input, standard output and standard error to /dev/null; otherwise, no changes are  made  to  these
       file descriptors.

作者: qq120848369   发布时间: 2011-11-07

用system函数,exec,都可以!

作者: ido158   发布时间: 2011-11-07

补充 在命令行下
exec ("/www/wdlinux/php-5.2.17 bgn.php >/dev/null &")

bash /www/wdlinux/php-5.2.17 bg.php >/dev/null &
都出错
bash: syntax error near unexpected token `"bgconversion.php >/dev/null &"'

作者: nmxkxp   发布时间: 2011-11-07