Nohup in linux
I want to continue running a PHP program and use this command nohup/data/www/wwwroot/military/server. php &
But this error is always reported:
Nohup: appending output to "nohup. out"
Nohup: cannot run command "/data/www/wwwroot/military/server. php": no file or directory
I can confirm that the path is correct. this file and directory are available!
What's the problem? please help me !!!
Reply to discussion (solution)
The PHP file is not an executable file. of course, an error will be reported,
Nohup php-f/data/www/wwwroot/military/server. php>/dev/null &
It has nothing to do with nohup.
/Data/www/wwwroot/military/server. php cannot run directly. add the php executable file path,/data/www/wwwroot/military/server. php is passed as a parameter to the php executable file. For example,/usr/bin/php depends on your own php installation location.
Nohup/usr/bin/php/data/www/wwwroot/military/server. php
Or add the shebang comment in the first line of your server. php and grant the server. php executable permission.
#! /Usr/bin/php
...
?>
# Chmod + x/data/www/wwwroot/military/server. php
Nohup/data/www/wwwroot/military/server. php can be directly executed.
When nohup is used, no more & is equivalent to the effect of the bg command.
The answers are good. each score is 10 points. thank you!