bash - how to run simple php script from Daemon at CentOS? -


i need run simple php script every second in centos. told me should use daemon run php script every second in background. there guide how it? know nothing daemon , when search internet, looks complicated.

anyone can help?

this current code. keep running when run : php -q /check_status.php

but when disconnect server, stops running. should keep running?

!/usr/bin/php -q

<?php  require_once "system/daemon.php"; $daemon_options = array("appname" => "channel_usage"); system_daemon::setoptions($daemon_options);  system_daemon::start();  while (true) { //some php code }  sleep(1); ?> 

you can run command nohup infront of it, have continue executing if session ends.

example:

nohup ping google.com 

this keep pinging google if close ssh session.

or can schedule cronjob doing following (change command own needs):

echo "* * * * * /path/to/script.sh" >> /etc/crontab 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -