The first step is to give execute permission
#chmod +x /php_scripts/scan_userstatus.php
Execute the script alone to see if there are any errors
#php -q /php_scripts/scan_userstatus.php The
second step executes the script
#nohup php /php_scripts/scan_userstatus.php &
The content of the script is as follows
@file: /php_scripts/scan_userstatus.php
while (1) { $status = has_goaway(); if ($status) { //done } usleep(10000000); } ?>
View Process
View All Processes
ps to
view a process
ps aux|grep scan_userstatus.php
Dynamic view process
top
kill process
pkill -9 name killall name kill pid
Other related commands:
jobs: Check how many commands are currently running in the background
fg: Move the commands in the background to the foreground to continue running. If there are multiple commands in the background, you can use fg %jobnumber to call out the selected command. %jobnumber is the serial number (not pid) of the command being executed in the background found through the jobs command.
bg: A command that is suspended in the background, to continue execution. If there are multiple commands in the background, you can use bg %jobnumber to call out the selected command. %jobnumber is the serial number (not pid) of the command being executed in the background found through the jobs command.